-
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
Shadows: Improve accessibility of shadows dropdown #58828
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: +161 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Where do I find the shaddows dropdown? |
@alexstine Sorry, testing instructions were not clear. Updated the PR description. Tagging @richtabor and @jasmussen for design feedback. |
@alexstine could you provide feedback on this possibly before WP 6.5 Beta 3 |
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.
@madhusudhand Thanks for the PR. I just tested this and can certainly notice the improvements.
The one thing that isn't great about dropdowns such as this one is there is no way to tell which option is selected without interacting with the dropdown. This is where I really wish Gutenberg would just use a native select as it was made for this reason.
For example, if I come to an aria-label of Drop shadow, that doesn't tell me which option is selected but due to the rules of changing states, it would not be viable to dynamically update that aria-label. Form controls should never convey states.
@jeryj I feel like you worked on a PR for a similar dropdown before, any thoughts?
Otherwise, approving this as it is an improvement nonetheless.
e5f80ae
to
932e4f1
Compare
932e4f1
to
5f35fea
Compare
Flaky tests detected in 585e821. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8005449614
|
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.
Thanks for your work on this! I left a few comments. @alexstine the work I did for some of these kinds of elements was to show the selected value on the button that opens the popover. That could be a nice follow-up to this: Add the selected shadow value as an aria-label and visual icon on the button that opens the shadow options.
} | ||
) } | ||
render={ | ||
<Button |
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.
Do these still need to be buttons? Having a button within an Option seems odd. Can we remove the button and have the shadow icon be the direct content of the <option>
instead?
const { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } = | ||
unlock( componentsPrivateApis ); | ||
const compositeStore = useCompositeStore(); | ||
return ! presets ? null : ( | ||
<Grid columns={ 6 } gap={ 0 } align="center" justify="center"> | ||
<Composite | ||
store={ compositeStore } | ||
role="listbox" |
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.
I'm surprised we need to unlock a component for this. Is there another way to build this custom listbox without needing to unlock the componentsPrivateApis for 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.
Thanks @jeryj. I followed the implementation of duotone as they both have similar UI. I will create a followup issue and address it as enhancement.
Changing the label from enhancement to bug as the acceptability of the shadows dropdown wasn't correct, and this fixes it. |
* Improve accebility of shadows dropdown * fix mobile unit tests by moving privateApis unlock inside components
I just cherry-picked this PR to the cherry-pick-wp-6-5-beta-3 branch to get it included in the next release: 52c4570 |
* Improve accebility of shadows dropdown * fix mobile unit tests by moving privateApis unlock inside components
What?
This improves the keyboard accessibility of the shadows dropdown.
Before:
Each shadow item was a button before this change and a
Tab
navigation is required to switch shadows with keyboard.After:
Shadows are now act a listbox and allows to change between the shadow items using keyboard
left <-
andright ->
arrows.Also, introduced a
transform: 1.2
on hover for better mouse accessibility (similar to duotone)Testing Instructions
Testing Instructions for Keyboard
Try invoking and applying shadows using keyboard navigation
Tab:
to switch between menu itemsSpace/Return:
to invoke or apply a shadowArrow keys:
to switch between shadows.