-
Notifications
You must be signed in to change notification settings - Fork 10.8k
[Accessibility] Add id and aria-label attributes to photoswipe dialog #59981
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
Conversation
Testing GuidelinesHi , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances accessibility for the PhotoSwipe image gallery dialog by adding proper ARIA attributes and an ID to improve screen reader navigation and compliance with accessibility standards.
- Adds
id
andaria-label
attributes to the PhotoSwipe dialog container - Updates the gallery trigger button to include
aria-controls
attribute linking to the dialog - Updates template version number to reflect the accessibility improvements
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
plugins/woocommerce/templates/single-product/photoswipe.php | Adds id and aria-label attributes to the PhotoSwipe dialog container and updates template version |
plugins/woocommerce/client/legacy/js/frontend/single-product.js | Adds aria-controls attribute to the gallery trigger button to establish relationship with the dialog |
plugins/woocommerce/changelog/fix-59953 | Documents the accessibility fix in the changelog |
plugins/woocommerce/client/legacy/js/frontend/single-product.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dkotter This PR is ready for code review. |
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; // Exit if accessed directly. | ||
} | ||
?> | ||
|
||
<div class="pswp" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true"> | ||
<div id="photoswipe-fullscreen-dialog" class="pswp" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" aria-label="<?php esc_attr_e( 'Full screen image', 'woocommerce' ); ?>"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I should know this I guess but is there ever a chance a product might have multiple Photoswipe dialogs on one page, and thus these IDs would need to be unique?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkotter I tested different product pages and didn't see anyone with more than one PhotoSwipe container. Looking at the codebase, we can see that the template is added once to the page only if the product gallery is supported.
When tested with the Product Bundles extension, I verified that the same container is used whether the gallery is triggered by clicking on the magnifying glass icon or the product thumbnail.
So basically, I don't see any chance of having more than one PhotoSwipe dialog on the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ankitguptaindia @qasumitbagthariya This is ready for QA
I'll update the branch and open the PR for reviews, so the tests run |
📝 WalkthroughWalkthroughThis change updates the accessibility attributes for the Photoswipe dialog in WooCommerce. It adds Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually tested and we're good! Thanks for the contribution, @Manussakis !
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #59953 .
Closes #59747 .
(For Bug Fixes) Bug introduced in PR # .
Screenshots or screen recordings:
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
aria-controls="photoswipe-fullscreen-dialog"
attribute.id="photoswipe-fullscreen-dialog"
aria-label="Full screen image"
Testing that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment