-
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
ColorPalette: Disable Clear
button if there's no color value.
#67108
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. |
<CircularOptionPicker.ButtonAction onClick={ clearColor }> | ||
<CircularOptionPicker.ButtonAction | ||
onClick={ clearColor } | ||
disabled={ ! value } |
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.
Let's also add accessibleWhenDisabled
prop here.
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 the review. I've added it. I also applied the same logic to the GradientPicker
and DuotonePicker
.
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.
Let's also add
accessibleWhenDisabled
prop here.
Thanks for catching that.
…. Add `accessibleWhenDisabled` for all the changes.
Flaky tests detected in 50d781e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11915640893
|
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.
LGTM, thank you!
It's worth reminding why in most cases there is the need to use When using the keyboard, disabling a button on the fly with To avoid focus losses and to make controls discoverable also when disabled, Gutenberg uses the |
Thank you both! And thanks, @afercia, for the detailed explanation—I’ll definitely keep that in mind moving forward. 🙌 Merging this one now! 🚀 |
What?
Fixes #67107
Disable the "Clear" button if there's no color value for the color palette component.
EDIT: I also applied the same logic to the
GradientPicker
andDuotonePicker
here.Why?
The “Clear” button in the ColorPalette is currently active even when no color value is set. This can be confusing for users, as clicking the button doesn’t do anything in this case. It would be more intuitive if the button were disabled when there’s no color to clear.
How?
By setting it disabled. if there's no value.
Testing Instructions
Color picker & gradient picker
Duotone
Screenshots or screencast
Screen.Recording.2024-11-19.at.10.56.44.mov