-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Carousel: Improve keyboard and screen reader accessibility #42134
base: trunk
Are you sure you want to change the base?
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
Switch from overriding the image content to make items clickable to ensuring all images are wrapped in links, with additional context for screen readers.
af2e33a
to
a22e90c
Compare
Fixes #39926, though it seemed to be opposite when I tested (clicking gave the carousel, while keyboard took me to the attachment page). Throughout the images and galleries, the behavior between mouse and keyboard are now the same. This also improves the carousel keyboard behavior by creating a focus trap so that keyboard users can effectively navigate (and close) the carousel.
Proposed changes:
.screen-reader-text
span into the link, which will indicate the button's action without overwriting the alt text on the image† These are already in links, generally, so for compatibility I stayed with links, with role=button to indicate correct keyboard interactions.
‡ This works great in "normal" cases where someone opens and closes an image, but there's an edge case if the page reloads with carousel open. If a page has the same image multiple times and is reloaded, on close it will focus back to the first instance of the photo. In general I think the focus improvement is worth this, but I'm open to feedback.
Other information:
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Try running through the same steps with a screen reader, though it's a little janky, it is a better experience. The image alt text is actually read aloud now, and is included on the large image too.