Skip to content

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

Open
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65438-media-grid-no-title-aria-label
Open

Media: Restore accessible name for media items without a title#12136
itzmekhokan wants to merge 1 commit 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.

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

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.

2 participants