-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Tooltip: add aria-describedby to anchor only if not redundant #65989
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
tyxla
left a comment
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.
Code-wise this looks good to me 👍 I think it's a good compromise, considering we'll seek a better long-term fix.
Leaving the potential approval to @afercia after confirming it resolves the problem.
|
Thanks for working at this fix. I don't have bandwidth to test it now but as long as:
then I'd think it's a reasonable short-term solution until the root problem gets solved. Thanks! |
|
I'll add a couple of unit tests and temporary storybook examples to validate the thesis further |
a2e7c44 to
4345c49
Compare
|
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. |
|
Added unit tests, a couple of temporary Storybook examples, and updated PR description. Let's give this PR a round of review and merge if it improves the current situation for the 6.7 release. |
4345c49 to
7ea28ad
Compare
t-hamano
left a comment
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.
LGTM!
I tested screen readers primarily on the post editor and site editor, and there were no issues with double reading of labels or inappropriate reading of descriptions.
Here is an example of that test:
Block Toolbar
block-toolbar.mp4
Header and Sidebar
2d9840e9931d4d7b8d9d3cc9fd47f0e7.mp4
7ea28ad to
7048449
Compare
|
Thank you for the reviews! Enabled auto-merging + backporting to WordPress 6.7 release |
* Improve comment * Add unit tests * Add temporary storybook examples * CHANGELOG * Fix lint errors * Remove temporary storybook examples --- Co-authored-by: ciampo <[email protected]> Co-authored-by: tyxla <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: afercia <[email protected]>
|
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: 1fdd5d9 |
|
Thanks @ciampo! We should look into removing the patch next, which I believe you created a draft PR for somewhere else. I will look at everything once I'm back from sick leave. |
Yup, see #66021 |
* Improve comment * Add unit tests * Add temporary storybook examples * CHANGELOG * Fix lint errors * Remove temporary storybook examples --- Co-authored-by: ciampo <[email protected]> Co-authored-by: tyxla <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: afercia <[email protected]>
…ess#65989) * Improve comment * Add unit tests * Add temporary storybook examples * CHANGELOG * Fix lint errors * Remove temporary storybook examples --- Co-authored-by: ciampo <[email protected]> Co-authored-by: tyxla <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: afercia <[email protected]>
What?
Related to #65888
This PR makes changes to the
Tooltipcomponent so that thearia-describedbyattribute gets added more conservativelyWhy?
As discussed in #65888, the way
Tooltipadds anaria-describedbyattribute can disrupt assistive technology users:How?
Implementing @t-hamano 's suggestion: the
Tooltipcomponent checks that there isn't aaria-describedbyattribute already defined, and that the tooltip text is different from the anchor's accessible label.Testing Instructions
aria-describedbyattribute. Inspecting the anchor, make sure that thearia-describedbyattribute doesn't change when the tooltip is shown.aria-labelattribute, and that the tooltip text is the same as the anchor'saria-label. Inspecting the anchor, make sure that thearia-describedbyattribute is not added to the anchor when the tooltip is shown.I've added a couple of temporary Storybook examples to help with testing in isolation.
In the editor, you can test this by:
buttonresponsible for triggering the "options" dropdown (the last one in the toolbar)aria-describedbyattribute added for the tooltipScreenshots or screencast
Kapture.2024-10-09.at.16.31.29.mp4