close
Skip to content

Image: Fix missing aria-label on lightbox trigger button for single images#78426

Merged
t-hamano merged 2 commits into
WordPress:trunkfrom
R1shabh-Gupta:fix/image-lightbox-trigger-aria-label
May 19, 2026
Merged

Image: Fix missing aria-label on lightbox trigger button for single images#78426
t-hamano merged 2 commits into
WordPress:trunkfrom
R1shabh-Gupta:fix/image-lightbox-trigger-aria-label

Conversation

@R1shabh-Gupta
Copy link
Copy Markdown
Contributor

@R1shabh-Gupta R1shabh-Gupta commented May 19, 2026

What?

Closes #78413

Restores the aria-label attribute on the lightbox trigger button for single image blocks that have "Enlarge on click" enabled.

Why?

The commit that added gallery lightbox support changed the trigger button to use a dynamic aria-label binding, but left triggerButtonAriaLabel as null for single images. So the attribute was never rendered on the
frontend.

How?

Set triggerButtonAriaLabel to "Enlarge" at render time in the image block's PHP render function.

Testing Instructions

  1. Create a new post or page.
  2. Insert a single Image block and upload or select any image.
  3. With the image selected, open the Link toolbar dropdown and choose "Enlarge on click".
  4. Publish or preview the page.
  5. Inspect the lightbox trigger button (button.lightbox-trigger) in browser DevTools and confirm it has aria-label="Enlarge".

Testing Instructions for Keyboard

  1. On the published/previewed page, Tab to the lightbox trigger button on the image.
  2. Activate VoiceOver (macOS: Cmd + F5) or NVDA (Windows).
  3. Confirm the screen reader announces "Enlarge".

Screenshots or screencast

Before After
before after

Use of AI Tools

None

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label May 19, 2026
@R1shabh-Gupta R1shabh-Gupta marked this pull request as ready for review May 19, 2026 07:37
@github-actions
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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: R1shabh-Gupta <rishabhwp@git.wordpress.org>
Co-authored-by: joedolson <joedolson@git.wordpress.org>

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

@t-hamano t-hamano added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Regression Related to a regression in the latest release [Block] Image Affects the Image Block labels May 19, 2026
@github-project-automation github-project-automation Bot moved this to 🔎 Needs Review in WordPress 7.0 Editor Tasks May 19, 2026
@t-hamano t-hamano added the Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release label May 19, 2026
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Nice catch!

@t-hamano t-hamano merged commit 9cf288c into WordPress:trunk May 19, 2026
55 of 59 checks passed
@github-project-automation github-project-automation Bot moved this from 🔎 Needs Review to ✅ Done in WordPress 7.0 Editor Tasks May 19, 2026
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport to WP Minor Release Pull request that needs to be backported to a WordPress minor release [Block] Image Affects the Image Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block library /packages/block-library [Type] Regression Related to a regression in the latest release

Projects

Development

Successfully merging this pull request may close these issues.

A11y Regression: Individual image lightbox toggle has no accessible name

2 participants