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
Accessibility: Make text alignment items radio menu items. #19233
Conversation
Pass a role from the alignment toolbar to the dropdown menu. Make the dropdown menu aware of this role on each control and set it if present. Also set aria-checked on the active control if the role calls for it. Fixes #18721.
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.
It all makes sense. I guess I missed it completely when converting the alignment options to the dropdown. I think we have the same logic covered already in the MenuItem
component, so it would be a good idea to use this component rather than the IconButton
. The challenge here is that those block alignment toolbar (groups) support isCollapsed
flag. When they aren't collapsed, they should be regular IconButton
without the role applied. The easiest way to move forward would be to apply menuitemradio
role conditionally and move forward with your proposal. What do you think?
Yes, that makes sense. I will add that bit, hoping it will pass. :-) However, I have a problem currently that the conditional role is not yet being applied to those icon buttons. So when I try this PR on gutenberg.run, it is still a normal menu item, and aria-checked is not set at all. So I am not sure why. |
packages/block-editor/src/components/alignment-toolbar/index.js Outdated
Show resolved
Hide resolved
Awesome work, congrats on your first code contribution to Gutenberg 🎉 |
Description
Pass a role from the alignment toolbar to the dropdown menu. Make the dropdown menu aware of this role on each control and set it if present. Also set aria-checked on the active control if the role calls for it. Fixes #18721.
How has this been tested?
Screenshots
Types of changes
Bug fix.
Checklist: