Repository navigation
Media: Refresh attachment tile aria-label when model data loads - #13053
sornapudisuresh wants to merge 3 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
I quickly tested the approach in this PR and wanted to note that it also fixes a small quirk when uploading multiple attachments at the same time in the Media Library, which makes sense given the label is now updated on render. Before:
After:
|
Backbone only evaluates attributes() when the element is created, so tiles built for id-only models kept a stale uploading/(no title) label after fetch. Re-apply the accessible name in render() so the label catches up.
9ff0009 to
e36cc28
Compare
afercia
left a comment
There was a problem hiding this comment.
LGTM
Pushed a couple commits:
- rebased on top of latest trunk
- added
@sincetag - added QUnit tests
- Makes sure the attachments visible label (and aria-label) is updated and it's not stale showing "uploading..." or "(no title)" for attachments whose models load after the view is created. - Add QUnit tests. Developed in #13053 Props sureshsornapudi09, archon810, rezwanshiblu1952, joedolson, afercia. See #23562, #64883, #65438. Fixes #65852. git-svn-id: https://develop.svn.wordpress.org/trunk@64293 602fd350-edb4-49c9-b593-d223f7449a82
- Makes sure the attachments visible label (and aria-label) is updated and it's not stale showing "uploading..." or "(no title)" for attachments whose models load after the view is created. - Add QUnit tests. Developed in WordPress/wordpress-develop#13053 Props sureshsornapudi09, archon810, rezwanshiblu1952, joedolson, afercia. See #23562, #64883, #65438. Fixes #65852. Built from https://develop.svn.wordpress.org/trunk@64293 git-svn-id: http://core.svn.wordpress.org/trunk@63443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Media Library grid tiles can keep a stale
aria-label(uploading…/(no title)) when the view is created for an id-only attachment model that is still fetching. The visible CSS label overlay (added in 7.0) makes that staleness obvious to everyone, not only screen reader users.Problem
wp.media.view.Attachmentcomputesaria-labelonly inattributes(), and Backbone evaluates that once during_ensureElement(). Core (and Gutenberg) often create tiles viaAttachment.get( id )+fetch(), so the label is computed from empty model data and never updates when the model later receives a title — even thoughrender()re-runs on modelchange.This is distinct from #65438 / [62892], which only changes which fallback string is used for a titleless model.
Fix
getAriaLabel().aria-labelat the end ofrender()once the model has data.attributes(e.g.Attachment.Details, see #47458) so we do not add inappropriate attributes there.aria-checkedalone so selection state fromupdateSelect()is not clobbered.Testing instructions
uploading…/(no title)).(no title), and in-progress uploads still showuploading….aria-labelattributes added).Trac ticket: https://core.trac.wordpress.org/ticket/65852
Use of AI Tools
AI assistance: Yes
Tool(s): Cursor
Model(s): Cursor Grok 4.5
Used for: Implementation assistance following the approach suggested on the Trac ticket. Changes were reviewed against the codebase and existing Attachment.Details attribute reset pattern.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.