-
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
Cover: Fix placeholder color options keyboard accessibility #68662
base: trunk
Are you sure you want to change the base?
Cover: Fix placeholder color options keyboard accessibility #68662
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. |
Size Change: +44 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Since any UI in the editor should be operable with the keyboard at least for a basic usage, and this UI isn't, I would appreciate this PR to be considered for the next WordPress release. Cc @WordPress/gutenberg-core |
Pinging @WordPress/gutenberg-components as well for feedback. |
Fixes #68639
What?
asButtons
set to true, it would be best for it to have arole=group
and appropriate labeling.Why?
How?
In the fist commit
Setting
asButtons
to true makes the circular options picker render the buttons as a a list of buttons that are all focusable and tabbables. This basically removes the arrow keys navigation that is in use when the options are rendered as a listbox, which conflicts with WritingFlow.In the second commit.
I just wanted to set a
role="group"
and a meaningfularia-label
whenasButtons
is true. This is important because otherwise the options are just a series of buttons. Adding arole="group"
to the wrapper makes them logically grouped and thearia-label
communicates users what this group of buttons is about.However, I discovered that adding
aria-label
didn't render an aria-label attribute whenasButtons
is true. Turned out the aria-label and aria-labelledby props were only allowed for theListboxCircularOptionPicker
and not forButtonsCircularOptionPicker
.I'm not that familiar with TypeScript and I had to make a series of changes to make this work that honestly I don't fully understand. I would greatly appreciate some eyes from contributors more familiar than me with TypeScript.
Note that I had to make changes to the allowed types also for the components that consume
CircularOptionPicker
which are:ColorPalette
,DuotonePicker
andGradientPicker
.To recap;
on trunk, by default the circular option picker renders:
role="listbox"
aria-label="Custom color picker."
that cab be passed a custom aria-labelInstead, when rendered as normal buttons via
asButton
, it renders:aria-label
doesn't workI just want the
asButtons
version have arole=group
and anaria-label
.Note: to my understanding, this old issue #54055 was aiming to provide a better labeling mechanism for these components but it seems it still needs to be addressed. It would be nice to consider further improvements in the context of that issue.
Testing Instructions
role="group"
and anaria-label="Background color"
.Testing Instructions for Keyboard
Screenshots or screencast