-
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
Setting a default gradient on a block prevents user from changing background to a solid color #47391
Comments
This is an interesting problem as this is just reflecting how CSS is expected to work, ie. It could be fixed by changing the background color presets to also reset the background: background: none !important
background-color: var(--wp...) !important but we risk inadvertently removing other theme/global CSS background settings this way. Another option to reduce this risk would be to move the gradients from background-image: none !important
background-color: var(--wp...) !important This still has the potential to reset It gets more complicated in the case of custom colors as these are added to the post content as inline styles, so adding a new Do we need an extra attribute flag for background color, eg. I could be overlooking a simpler solution, or maybe I am overthinking the potential issues of resetting the background if a background color is set? If I am not overlooking a simpler solution then this may need to be punted from 6.2 given the timeframe. |
Design - this needs some thought about how the background color support should work when a background gradient or image is present, as the default CSS behavior is for the background color to act as a fallback rather than an override. Do we need a toggle on the background color setting so users can explicitly choose for the background color to act as an override. N.B This would probably require moving gradient to |
I think it would be unfortunately to add yet another toggle or config option for a background color to override this or that. Using I am not intimately familiar with how the css is being built on the editor side of things, but I think the best thing would be if the generic If the css from theme.json is printed in a div:not([style*="background-image"]) {
/* default background */
background-image: linear-gradient();
} (example) |
Given the complexity of this issue and the final Beta release is next Tuesday, I recommend we punt from 6.2. |
Description
If you use
theme.json
to set a default gradient on a block, if the user attempts to set a solid background color of that block from within the editor, the color doesn't change in the editor. The modified background color does show up on the front-end.I've tried this on both the button block and the group block with the same result.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: