Add aria-label to Revisions button in Post Summary sidebar#78140
Conversation
|
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 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. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @vishnucmsminds! 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. |
|
@vishnucmsminds, Do you know about E2E tests? The button label has changed, so we need to update the E2E tests accordingly. The files that need to be modified are as follows:
In other words, we need to change the code included in the file above as follows. } );
await settingsSidebar.getByRole( 'tab', { name: 'Post' } ).click();
await settingsSidebar
- .getByRole( 'button', { name: '2', exact: true } )
+ .getByRole( 'button', { name: 'Open revisions screen: 2 revisions' } )
.click();
await expect(
page.getByRole( 'button', { name: 'Restore' } ) |
Thanks for the feedback @t-hamano! I've updated the E2E tests in the following files to match the new button label: Please let me know if any further changes are needed. |
* Add aria-label to Revisions button in Post Summary sidebar * Change ariaLabel to aria-label for better standard compliance * Update E2E tests to match the new revisions button aria-label * Update E2E tests to match new Revisions button aria-label --------- Co-authored-by: vishnupprajapat <vishnuprajapat@git.wordpress.org> Co-authored-by: vishnucmsminds <prajapatvishnu@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: ad384d5 |
What?
Closes #78138
This PR adds a descriptive
aria-labelto the Revisions button in the Post Summary sidebar panel.Why?
Previously, the Revisions button in the Post Summary sidebar only displayed the count of revisions (e.g., "3"). For screen reader users, this was announced simply as "3 button," which lacked context. Adding a descriptive
aria-labelensures that users understand the button's purpose is to open the revisions screen.How?
In
packages/editor/src/components/post-last-revision/index.js, I've updated thePrivatePostLastRevisioncomponent'sButtonto include anariaLabelprop. The label is localized and dynamically includes the revision count:Open revisions screen: %s revisions.Testing Instructions
aria-labelattribute likearia-label="Open revisions screen: X revisions".Testing Instructions for Keyboard
Tabkey.Use of AI Tools
This PR was authored with the assistance of Claude Opus 4.6. I have reviewed and tested the changes to ensure they meet the project's standards and solve the reported accessibility issue.