Skip to content

Media: Restore accessible name for media items without a title - #12136

Closed
itzmekhokan wants to merge 7 commits into
WordPress:trunkfrom
itzmekhokan:fix/65438-media-grid-no-title-aria-label
Closed

Media: Restore accessible name for media items without a title#12136
itzmekhokan wants to merge 7 commits into
WordPress:trunkfrom
itzmekhokan:fix/65438-media-grid-no-title-aria-label

Conversation

@itzmekhokan

Copy link
Copy Markdown

Saved attachments without a title were being announced as "uploading…" in the Media Library grid view. This restores a meaningful accessible name for them while keeping the upload-progress naming added in [62104].

What the problem was:

  • [62104] (follow-up to #64883) set the grid item aria-label to title || 'uploading…' so in-progress uploads get an accessible name.
  • That fallback also matched any saved attachment with no title, so every titleless image was announced as "uploading…".

What the fix does:

  • Limits the "uploading…" fallback to items that are actually uploading.
  • Falls back to the existing "(no title)" string for saved attachments that have no title.

Approach and why:

  • A simple swap of "uploading…" → "(no title)" (per comment:1) would re-break #64883, since real uploads have no title yet. Gating on the model's uploading flag satisfies both tickets.
  • Both "uploading…" and "(no title)" already exist as translatable core strings, so no new strings are introduced.

Testing instructions:

  1. In the Media Library, ensure you have an image with no Title set.
  2. Open the grid view (Media → Library, grid mode) and inspect the image tile: its <li class="attachment"> aria-label should read "(no title)" (verify with a screen reader or the browser a11y inspector), not "uploading…".
  3. Upload a new file and, while it is uploading, confirm its tile's aria-label still reads "uploading…".
  4. Confirm an image that has a title is unchanged (announced by its title).

Trac ticket: https://core.trac.wordpress.org/ticket/65438

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.8
Used for: Ticket and regression analysis (tracing the cause to [62104]) and drafting the one-line fix. All changes were reviewed, validated against the codebase, and are taken responsibility for by me.


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.

Changeset [62104] added an "uploading…" fallback for the grid item
`aria-label` so that in-progress uploads, which have no title yet,
get an accessible name. That fallback also matched saved attachments
that simply have no title, so every titleless image was announced as
"uploading…" in the Media Library grid view.

Limit the "uploading…" fallback to items that are actually uploading,
and fall back to the existing "(no title)" string for saved
attachments without a title. Both strings already exist in core, so
no new translatable strings are introduced.

Follow-up to [62104].

Fixes #65438.
See #64883.
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props khokansardar, joedolson, cbravobernal, ankitkumarshah, masteradhoc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@Infinite-Null

Copy link
Copy Markdown

Hi @itzmekhokan,
Tested this PR and can see that it successfully resolves the issue.

I verified that media items without a title are now listed as "(no title)" instead of "uploading…" in the Media Library grid view. Media items with titles remain unaffected.

Screenshot attached for reference.

Before:
Screenshot 2026-06-10 at 9 18 07 PM

After
Screenshot 2026-06-10 at 9 29 33 PM

@masteradhoc

Copy link
Copy Markdown

Thanks for the PR @itzmekhokan. I can confirm this PR works as expected and the results are as @Infinite-Null showed them in the comment above. LGTM

@cbravobernal
cbravobernal requested a review from joedolson June 30, 2026 10:28
Comment thread src/js/media/views/attachment.js Outdated
Build the aria-label value with an explicit if/else block instead of a
nested ternary for readability.

See #65438.
@itzmekhokan
itzmekhokan requested a review from cbravobernal June 30, 2026 10:42
@masteradhoc

Copy link
Copy Markdown

The Adjustment didnt work out for me. When the upload finished and the media library page is refreshed its again saying "uploading..."

@itzmekhokan

Copy link
Copy Markdown
Author

The Adjustment didnt work out for me. When the upload finished and the media library page is refreshed its again saying "uploading..."

Thanks for testing! This change lives in the source module src/js/media/views/attachment.js, but the Media Library loads the compiled wp-includes/js/media-views.js bundle (a gitignored build artifact, so it's not in the diff). Until that's rebuilt, your site keeps serving the old title || 'uploading…' line, which is why a refresh brings it back.

Please rebuild after checking out the branch:

npm install
grunt build

@cbravobernal cbravobernal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Changeset [62104] added an "uploading…" fallback for the grid item
`aria-label` so that in-progress uploads, which have no title yet,
get an accessible name. That fallback also matched saved attachments
that simply have no title, so every titleless image was announced as
"uploading…" in the Media Library grid view.

Limit the "uploading…" fallback to items that are actually uploading,
and fall back to the existing "(no title)" string for saved
attachments without a title. Both strings already exist in core, so
no new translatable strings are introduced.

Follow-up to [62104].

Fixes #65438.
See #64883.
Build the aria-label value with an explicit if/else block instead of a
nested ternary for readability.

See #65438.
@cbravobernal
cbravobernal force-pushed the fix/65438-media-grid-no-title-aria-label branch from 0ac207f to da16e3d Compare July 14, 2026 08:56
Copilot AI review requested due to automatic review settings July 29, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@joedolson joedolson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

pento pushed a commit that referenced this pull request Jul 29, 2026
In the media library, the `aria-label` for an untitled image fell back to "uploading...", the string used during the upload processing. Change the values so that images only use "uploading..." during the uploading process, but otherwise use "(no title)", like other untitled items.

Developed in #12136

Props jamieburchell, presskopp, khokansardar, joedolson, tusharaddweb, ankitkumarshah, chillifish, masteradhoc, cbravobernal.
Fixes #65438, see #64883.

git-svn-id: https://develop.svn.wordpress.org/trunk@62892 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62892
GitHub commit: d99627d

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Jul 29, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jul 29, 2026
In the media library, the `aria-label` for an untitled image fell back to "uploading...", the string used during the upload processing. Change the values so that images only use "uploading..." during the uploading process, but otherwise use "(no title)", like other untitled items.

Developed in WordPress/wordpress-develop#12136

Props jamieburchell, presskopp, khokansardar, joedolson, tusharaddweb, ankitkumarshah, chillifish, masteradhoc, cbravobernal.
Fixes #65438, see #64883.
Built from https://develop.svn.wordpress.org/trunk@62892


git-svn-id: http://core.svn.wordpress.org/trunk@62159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants