-
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
Add ability to unset duotone in themes with default duotone set #39564
Conversation
Size Change: +1.04 kB (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
3c246ea
to
2b76d86
Compare
2b76d86
to
5aacb4d
Compare
Alright, I pushed a small tweak that gets us to this: Conceptually the "unset" icon is the same as these: Right now, however, the way that's built is a little hacky. I'll leave some comments in the code in a second to elaborate on that. But it means that the toolbar now looks like this, because technically that "unset" state isn't an icon: It could be, if it needed to be. Here's an icon version of it:
... but there's a little more to it as well, specifically that the That's why I ended up going the way I did with the commit, adding the linear gradient background for now, and then hopefully if we can refactor to use
|
87b3459
to
ab3b254
Compare
ab3b254
to
b724b79
Compare
b724b79
to
b067b00
Compare
) } | ||
{ ! disableCustomDuotone && ( | ||
<ColorListPicker | ||
labels={ [ __( 'Shadows' ), __( 'Highlights' ) ] } | ||
colors={ colorPalette } | ||
value={ value } | ||
value={ isUnset ? undefined : 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.
We do this 3 times. Should we make it a variable?
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.
It's only used in two places—ColorListPicker
and CustomDuotoneBar
—and I can't think of a good name for what to call it that would make the code any more readable. Do you have a suggestion?
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 left a few nitpicks but it would be great to get this in.
I can see how that would be confusing. That's the focus border for the swatch because it's the first focusable element in the dropdown. You don't see it in the color/gradient picker because there's usually something above it that gets the focus. What do you think would be a good solution? Something needs to be focused for keyboard accessibility. Should the focus go to the second element—the fist colored swatch? Should the unset selector go to the end of the list? Or something else? EDIT: linking up #34073 (comment) for easy access to the earlier discussion |
This does make sense, and I can't think of a better solution so I think leave it as it is. |
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 tested and it worked as expected 🚀
This add the ability to unset duotone in themes with default duotone set. This commit backports the original PRs from Gutenberg repository: * [WordPress/gutenberg#39564 #39564: Add ability to unset duotone in themes with default duotone set] * [WordPress/gutenberg#42020 #42020: Remove: Unrequired regex search on duotone supports] Follow-up to [50929], [52757]. Props ajlende, jorgefilipecosta, Joen, cbravobernal. See #56467. Built from https://develop.svn.wordpress.org/trunk@54101 git-svn-id: http://core.svn.wordpress.org/trunk@53660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This add the ability to unset duotone in themes with default duotone set. This commit backports the original PRs from Gutenberg repository: * [WordPress/gutenberg#39564 #39564: Add ability to unset duotone in themes with default duotone set] * [WordPress/gutenberg#42020 #42020: Remove: Unrequired regex search on duotone supports] Follow-up to [50929], [52757]. Props ajlende, jorgefilipecosta, Joen, cbravobernal. See #56467. Built from https://develop.svn.wordpress.org/trunk@54101 git-svn-id: https://core.svn.wordpress.org/trunk@53660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This add the ability to unset duotone in themes with default duotone set. This commit backports the original PRs from Gutenberg repository: * [WordPress/gutenberg#39564 #39564: Add ability to unset duotone in themes with default duotone set] * [WordPress/gutenberg#42020 #42020: Remove: Unrequired regex search on duotone supports] Follow-up to [50929], [52757]. Props ajlende, jorgefilipecosta, Joen, cbravobernal. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54101 602fd350-edb4-49c9-b593-d223f7449a82
Added the Needs Dev Note label in case this needs a dev note (either individual or as part of a "misc" dev note) for WP 6.1 release. |
This add the ability to unset duotone in themes with default duotone set. This commit backports the original PRs from Gutenberg repository: * [WordPress/gutenberg#39564 #39564: Add ability to unset duotone in themes with default duotone set] * [WordPress/gutenberg#42020 #42020: Remove: Unrequired regex search on duotone supports] Follow-up to [50929], [52757]. Props ajlende, jorgefilipecosta, Joen, cbravobernal. See #56467. Built from https://develop.svn.wordpress.org/trunk@54101
Removed |
This add the ability to unset duotone in themes with default duotone set. This commit backports the original PRs from Gutenberg repository: * [WordPress/gutenberg#39564 #39564: Add ability to unset duotone in themes with default duotone set] * [WordPress/gutenberg#42020 #42020: Remove: Unrequired regex search on duotone supports] Follow-up to [50929], [52757]. Props ajlende, jorgefilipecosta, Joen, cbravobernal. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54101 602fd350-edb4-49c9-b593-d223f7449a82
What?
Fixes #38504
Add option to disable theme duotone per-block.
Why?
Sometimes you may want to disable a theme-wide duotone filter.
How?
Adds a swatch to unset the duotone filter set by a theme.json.
Selecting the swatch saves
'unset'
as thestyle.color.duotone
attribute instead of an array of colors.Testing Instructions
Screenshots or screencast
Screen recording of unsetting a global styles duotone filter.
The unset swatch in the dropdown.
The unset swatch in the toolbar.