-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Allow defining an aria-label in group blocks #41744
Conversation
Size Change: +9.03 kB (+1%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
Thanks @aristath . I'll review this soon. |
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.
@aristath Accessibility is working great here.
I added one question below but I think I already answered it.
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.
Everything seems to be working for me. Thanks! 👍
Added the Needs Dev Note label in case this needs a dev note (either individual or as part of a "misc" dev note) for WP 6.1 release. |
I can write a dev note on the make blog if we want... Or do we want this to be a part of a "misc" dev-note as mentioned above @mburridge ? |
What?
This PR allows defining an ARIA label for group blocks.
Why?
When there are multiple landmarks of the same type (
<nav>
,<aside>
,<section>
etc), assistive technologies have no way to differentiate them. Group blocks allow users to select the HTML element they need, but in doing so, introduce an a11y issue.This PR attempts to resolve that, by allowing users & theme-developers to manually add an ARIA label in their templates.
How?
Since this is something that may eventually be needed in other blocks, it was implemented as a hook.
To add support, we can simply define
supports.ariaLabel
astrue
inblock.json
files.This implementation does NOT add a UI for the aria-label. A visible option would have the potential to confuse users, and could cause more harm than good if they enter the wrong thing or misunderstand the purpose.
However, allowing users & theme-authors to manually define an aria-label in their templates is something that can significantly enhance the a11y of themes, without exposing any option to users. Furthermore, implementing this as a hook will allow us to implement a UI if at some point in the future we choose to do so.
Right now, if we try to add an aria-label to a group block we get a validation error and this PR allows us to define the
aria-label
properly.Testing Instructions
You can use this content to test:
Before the PR: validation errors in the 2
<aside>
groups.After the PR: it works 🎉