-
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
ToolbarButton: Always keep focusable when disabled #63102
Conversation
9dffdb2
to
c985641
Compare
c985641
to
731f369
Compare
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. |
@@ -50,6 +50,7 @@ function ToolbarItem( | |||
|
|||
return ( | |||
<Ariakit.ToolbarItem | |||
accessibleWhenDisabled |
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 don't foresee a need for it, but technically a consumer can override this by passing accessibleWhenDisabled={ false }
. This is currently undocumented on our end, but we could document it if it ever becomes a need.
Flaky tests detected in a5b11eb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9792483814
|
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.
🚀
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.
Co-authored-by: Marco Ciampini <[email protected]>
Good catch, thanks! I guess I'll do a cleanup & normalization pass in a separate PR. I've seen some |
Oh, sorry, for some reason I didn't include any 🤦 If you edit any page in the site editor, and try selecting a template part block, the toolbar shows what it does in my comment. |
Ah ok, got it. That color is easy to fix, but when we take consistency and accessibility into consideration, I'm not sure if/how we should fix it 🤔 For example, it is in fact visibly grayed out in the "All locked" case I posted. I do think the button needs to remain focusable, but if so we need to visually show that it's disabled. Maybe something like this? CleanShot.2024-07-09.at.19.42.31.mp4But all in all, I'm leaning toward predictability/consistency, which is to visually gray out as usual when a button is disabled. It's potentially confusing to even a sighted mouse user if an enabled-looking button is unresponsive. What do you think? |
* ToolbarButton: Always keep focusable when disabled * Omit `__experimentalIsFocusable` from TS types * Fixup * Add changelog * Clarify deprecation comment Co-authored-by: Marco Ciampini <[email protected]> --------- Co-authored-by: mirka <[email protected]> Co-authored-by: ciampo <[email protected]> Co-authored-by: tyxla <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: t-hamano <[email protected]>
Fixes #57701
What?
Keeps disabled
ToolbarButton
s focusable in all instances.Why?
Toolbar/menu items are one of the UI elements that are generally recommended to keep focusable when disabled.
Testing Instructions
Play around with the Storybook code for the
ToolbarButton
s in theToolbar
story. Passingdisabled
should keep the button focusable.