-
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
Cover: Only show overlay controls when color support enabled #50115
Cover: Only show overlay controls when color support enabled #50115
Conversation
Size Change: -1.52 kB (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
}, [ | ||
defaultColors, | ||
themeColors, | ||
customColors, | ||
shouldDisplayDefaultColors, | ||
] ); |
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.
Added missing dep to keep linter happy.
}, [ | ||
customGradients, | ||
themeGradients, | ||
defaultGradients, | ||
shouldDisplayDefaultGradients, | ||
] ); |
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.
Added missing dep to keep linter happy.
jest.mock( | ||
'@wordpress/block-editor/src/components/colors-gradients/use-multiple-origin-colors-and-gradients', | ||
() => ( { | ||
__esModule: true, | ||
default: jest.fn( () => ( { | ||
disableCustomColors: true, | ||
disableCustomGradients: true, | ||
colors: [ | ||
{ | ||
name: 'Default', | ||
colors: [ | ||
{ | ||
name: 'Black', | ||
slug: 'black', | ||
color: '#000000', | ||
}, | ||
{ | ||
name: 'Cyan bluish gray', | ||
slug: 'cyan-bluish-gray', | ||
color: '#abb8c3', | ||
}, | ||
], | ||
}, | ||
], | ||
gradients: [], | ||
hasColorsOrGradients: true, | ||
} ) ), | ||
} ) | ||
); |
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'll try and clean this up tomorrow.
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've avoided mocking the useMultipleOriginColorsAndGradients
hook in favour of setting explicit editor settings in bbac907. I'm not 100% confident in that approach either so happy to change it if others have suggestions.
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.
The new approach matches the actual editor's behavior.
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.
Thank you, @aaronrobertshaw.
The fix works as expected!
Fixes: #50046
What?
Prevents display of overlay controls when color block supports are disabled.
Why?
It's confusing when a theme author might disable color supports but still has the Cover block's ad hoc color controls showing.
How?
hasColorsOrGradients
to returned object from theuseMultipleOriginColorsAndGradients
hookTesting Instructions
npm run test:unit packages/block-library/src/cover/test/edit.js
Theme.json to disable color support
Screenshots or screencast