-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Color Panel: Fix rendering of tabs with no color #51498
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
Conversation
d68518f to
396d22a
Compare
|
|
|
Size Change: 0 B Total Size: 1.4 MB ℹ️ View Unchanged
|
396d22a to
f54aab2
Compare
andrewserong
left a comment
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.
This is testing nicely for me, thank you for including the easy copy + paste theme.json snippets for each of the permutations, very thorough! 🙇
LGTM ✨
|
Thanks for the review, @andrewserong! |
|
Thanks @t-hamano 🙌 |
Fixes: #50267
Might be related to: #48893
What?
This PR fixes a problem in the ColorPanel component where Background or Gradient tabs are rendered even when there is no color available.
Why?
When adding the tabs to be displayed to the
tabsproperty array, there appears to be no check to see if they have available colors.How?
Check to see if it actually has available colors, as it does when generating element-level tabs.
Testing Instructions
Enable Emptytheme and update
theme.jsonas follows in each case, cnfirm that the expected results are obtained.Disable all gradient panels
No tabs should exist, only the background panel should appear in all color panels.
theme.json
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": { "appearanceTools": true, "color": { "customGradient": false, "defaultGradients": false, "gradients": [] } } }Disable all background panels
No tabs should exist, only solid gradient panel should appear in all color panels.
theme.json
Disable paragraph block gradient panel
Only for paragraph blocks, there should be no tabs, only background panel
theme.json
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": { "appearanceTools": true, "blocks": { "core/paragraph": { "color": { "customGradient": false, "defaultGradients": false, "gradients": [] } } } } }Disable paragraph block background panel
Only for paragraph blocks, there should be no tabs, only gradient panel
theme.json
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": { "appearanceTools": true, "blocks": { "core/paragraph": { "color": { "defaultPalette": false, "custom": false, "palette": [] } } } } }Disable all gradient panels except the paragraph block
Except for the paragraph block, it should have no tabs, only background panel
theme.json
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": { "appearanceTools": true, "color": { "customGradient": false, "defaultGradients": false, "gradients": [] }, "blocks": { "core/paragraph": { "color": { "customGradient": true, "defaultGradients": true } } } } }Disable all background panels except the paragraph block
Except for the paragraph block, it should have no tabs, only gradient panel
theme.json
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": { "appearanceTools": true, "color": { "defaultPalette": false, "custom": false, "palette": [] }, "blocks": { "core/paragraph": { "color": { "defaultPalette": true, "custom": true } } } } }