-
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
Add reset button to ColorGradientSettingsDropdown #67800
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: +147 B (+0.01%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in ecf1ea5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12464997774
|
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 PR!
This PR works as expected, but we may need to consider the clearable
prop when deciding whether to render the reset button.
For example, the color dropdown of the Social Icons block doesn't have a clear button:
On the other hand, the Cover block has a clear button:
I don't know why some blocks have clear buttons, but as a rule it might be better to synchronize the display of the reset button and the clear button.
Thanks so much for the review @t-hamano Good catch! I added the check to see if it's clearable. Although, I can't think of a good reason to have that prop on false. Plus, there's a way to reset them if you click the "color options" button. I'll open an issue for this. reset-color-dropdown.mp4 |
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!
- ✅ Dropdowns never be double-opened.
- ✅The reset button is always visible in mobile layouts.
- ✅ Fully keyboard accessible.
- ✅Works as expected in shadow panels.
packages/block-editor/src/components/colors-gradients/dropdown.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/shadows-edit-panel.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Everything looks good, let's ship this PR 👍 |
What?
Follow-up of #67116 (review)
Fixing #41866
Add an inline reset button to the ColorGradientSettingsDropdown, shown on hover/focus, if there's a value. This will complete the fix started in #67116, as there are different blocks that are using the ColorGradientSettingsDropdown (navigation, cover, social links)
Also, for the original implementation toggling the control, if it's open to avoid having multiple controls opened at the same time.
Why?
To make it easier to reset a color selection, reduce the number of clicks as it doesn't require opening the color options panel.
How?
Adding a button if there's a color value, to reset it. I'm leveraging the styles introduced in #67116 for the reset button.
Testing Instructions
Screenshots or screencast
Screen.Recording.2024-12-10.at.17.37.24.mov