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
Improve Accessibility in Product Collection Navigation #44599
Improve Accessibility in Product Collection Navigation #44599
Conversation
This includes: - Addition of animation state management in the frontend file to control the visual transition between pagination states. - Introduction of new SCSS rules for the start and finish animations, ensuring a seamless and visually appealing pagination experience. - Modification of the PHP logic to inject necessary HTML for the animation to be applied. These updates aim to provide a more engaging and responsive interface for users navigating through product collection.
…to add/44393-product-collection-implement-animation-for-page-changes
This commit introduces several improvements to enhance accessibility and user experience. Specifically, it adds new context properties to manage accessibility messages during the navigation process, including messages for loading and when a page has loaded. These changes ensure that screen reader users receive appropriate feedback during navigation. Changes made: - Added `accessibilityMessage`, `accessibilityLoadingMessage`, and `accessibilityLoadedMessage` properties to the `ProductCollectionStoreContext`. These properties store messages to be announced by screen readers during different stages of page navigation. - Implemented logic in the product collection store to update the `accessibilityMessage` during the start of navigation (showing a loading message) and upon completion (showing a loaded message). - Utilized a technique to ensure that consecutive identical messages are still announced by screen readers, by appending a no-break space to the message if it is the same as the previous one. This follows a pattern similar to the `@wordpress/a11y` package. - In `ProductCollection.php`, enhanced the block's HTML output to include these new accessibility messages and integrated them with the existing interactive data attributes. This ensures that the front-end components are fully prepared to handle these accessibility enhancements. - Added a new `div` with `class="screen-reader-text"` and `aria-live="polite"` attributes, which dynamically displays the accessibility message based on the navigation state. This div complements the visual pagination animation with an accessibility-focused mechanism for announcing the page load states to screen reader users. By addressing accessibility considerations with these enhancements, we're making Product Collection navigation more inclusive and user-friendly for all users.
Test Results SummaryCommit SHA: 4063ba9
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Hi @gigitux, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
CC: @kmanijak JFYI |
Hey @imanish003! Thanks for working on this! I tried to follow your testing instructions, but I didn't get any details about the status of the page. I just have details about the header: Screen.Capture.on.2024-02-14.at.21-16-44.mp4Am I doing something wrong? |
Hey @gigitux, Based on your video, it looks like you don't have pagination set up. The announcement feature I added doesn't activate on the initial page load; it's specifically designed for client-side pagination. This means that when a user navigates to a different page, it will first announce "Loading page, please wait," and then, once the page has loaded, it will announce "Page Loaded." As I pointed out in the 5th step, this announcement triggers on page changes:
Please let me know if still doesn't work 🙂 |
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.
My mistake! LGTM!
…mmerce-blocks, woocommerce
Changes proposed in this Pull Request:
This PR introduces improvements to enhance accessibility and user experience. Specifically, it adds new context properties to manage accessibility messages during the navigation process, including messages for loading and when a page has loaded. These changes ensure that screen reader users receive appropriate feedback during navigation.
Changes made:
accessibilityMessage
,accessibilityLoadingMessage
, andaccessibilityLoadedMessage
properties to theProductCollectionStoreContext
. These properties store messages to be announced by screen readers during different stages of page navigation.accessibilityMessage
during the start of navigation (showing a loading message) and upon completion (showing a loaded message).@wordpress/a11y
package.ProductCollection.php
, enhanced the block's HTML output to include these new accessibility messages and integrated them with the existing interactive data attributes. This ensures that the front-end components are fully prepared to handle these accessibility enhancements.div
withclass="screen-reader-text"
andaria-live="polite"
attributes, which dynamically displays the accessibility message based on the navigation state. This div complements the visual pagination animation with an accessibility-focused mechanism for announcing the page load states to screen reader users.By addressing accessibility considerations with these enhancements, we're making Product Collection navigation more inclusive and user-friendly for all users.
Closes #44394
How to test the changes in this Pull Request:
Tip: Consider throttling the network speed to "Slow 3G" to simulate slower loading times.
Changelog entry
Significance
Type
Message
Improve Accessibility in Product Collection Navigation
Comment