Repository navigation
fix: expose lightbox captions to assistive technology - #82705
johnfinnerty-nz wants to merge 3 commits into
Conversation
Signed-off-by: John Finnerty <297514060+johnfinnerty-nz@users.noreply.github.com>
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @johnfinnerty-nz. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
🤖 PR meta 🤖👋 Welcome👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @johnfinnerty-nz! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
Signed-off-by: John Finnerty <297514060+johnfinnerty-nz@users.noreply.github.com>
|
Performing docker testing shortly |
Signed-off-by: John Finnerty <297514060+johnfinnerty-nz@users.noreply.github.com>
|
Pushed the correction in 64515d2. Automated validation, run with Codex against a local WordPress instance in Docker Desktop:
This was one focused browser regression, not the full E2E suite or a manual screen-reader test. |
|
This still hides the caption, using |
|
Thanks, that makes sense. I’ve had another go at this in #83325, with the caption visible below the image and links and formatting kept intact. Longer captions can scroll, including with the keyboard. It’s still a draft as it needs proper screen reader testing. I’d be interested in your thoughts on the layout too, especially with #81500 looking at the same problem. |
What?
Closes #55088.
Keep lightbox captions available to assistive technology while keeping them visually hidden. Exclude the duplicate animation image from the accessibility tree.
Why?
display: noneremoves the caption from the accessibility tree. This loses useful context, especially when an image has an empty alt attribute and its description is in the caption.How?
Store the source caption as plain text, render one visually hidden
figcaptionfor the selected image, and hide it when there is no caption. Mark the duplicate animation figurearia-hidden="true"and give its image an emptyalt.The Playwright regression checks caption text, duplicate-image exclusion, safe text rendering, and navigation between captioned and uncaptioned images.
Testing Instructions
Testing Instructions for Keyboard
Use Tab and Enter to open the lightbox. Navigate its controls using the keyboard, then close it and check focus return. With a screen reader, read through the dialog and check that the selected caption is available without duplicate image announcements. Repeat after changing images.
Recorded validation
The existing validation comment for
64515d2reports a passing focused Chromium/Playwright regression in a local WordPress Docker environment, production build, typecheck, scoped JavaScript lint, PHP syntax, PHP coding standards, and commit hooks. This description update did not rerun those checks. Manual screen-reader testing remains unverified.Screenshots or screencast
None attached. The caption remains visually hidden; the accessibility tree and screen-reader behavior are the relevant checks.
Use of AI Tools
Codex assisted with implementation and the recorded local automated validation. ChatGPT assisted with reviewing and editing this description. Manual accessibility testing remains outstanding.