-
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
Global Styles: Fix block-level global styles color panels #34293
Conversation
BackgroundColor and color are opt-out block supports: they're enabled if there's support for any color unless the block opts-out from them explicitly. Global styles UI panels were't respecting this opt out process, which is why we add logic to validate whether or not a block has turned off background color and color supports.
Size Change: -589 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
packages/edit-site/src/components/editor/global-styles-provider.js
Outdated
Show resolved
Hide resolved
@oandregal I added unit specs to verify the color support opt-out behavior in For now, I used a dummy test component to validate logic. I wanted to use actual Global Styles Color Panel components as children for the provider, but it would've been a big lift to figure things out. It's probably best tackled in a separate PR. |
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 catching and fixing this.
Description
Background color and text color are opt-out block supports. That is to say, they're enabled if there's a support key for any color unless the block opts-out from them explicitly. For example, the paragraph block only specifies support for link colors.
gutenberg/packages/block-library/src/paragraph/block.json
Lines 35 to 37 in ac41a59
The global styles paragraph color panel, however, still displays both text and background color supports. This behavior is desired and expected.
The issue is that global styles UI panels aren't respecting blocks explicitly opting out of text and background color supports. The cover block is a specific example.
gutenberg/packages/block-library/src/cover/block.json
Lines 73 to 77 in 599b60d
How has this been tested?
Screenshots
Before
After
Types of changes
Bug fix. Potentially addresses #34150
Checklist:
*.native.js
files for terms that need renaming or removal).