-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add aria-checked to the selected heading level menu item. #42273
Conversation
Size Change: +19 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
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.
@afercia Works perfectly, nice fix.
@afercia While we are still on the subject, do you think there are other blocks that suffer from this issue? Might be worth checking which blocks are using this component and maybe look in to changing the component defaults. Looks like it is using ToolbarDropdownMenu. |
Thanks @alexstine. All the occurrences of |
about ancestor, there is already an ongoing issue/PR #40778 |
What?
In the heading level dropdown menu, the selected heading level is highlighted only visually. There's no semantics to indicate its 'selected' state.
Additionally, this menu provides a single choice: only one level can be selected at a time. A role of
menuitemradio
is more appropriate than the genericmenuitem
.Why?
When screen reader users navigate through the heading level items, they don't have a clue what the selected one is.
How?
Passing a prop
role: 'menuitemradio'
fixes the semantics. When the menu item component has this role, it also automatically handles thearia-checked
attribute, which provides the necessary information on the selected heading level.Testing Instructions
role="menuitemradio"
attribute.aria-checked="true"
attribute.aria-checked="false"
attribute.Screenshots or screencast