-
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
bug:theme.json controls core/cover
overlay opacity via settings.color.defaultGradients
#54140
Comments
Thanks for reporting @tresorama. This is a tricky bug. The overlay slider is part of the Color supports panel in the Setting Sidebar. When all the color controls are disabled, so is the Color support panel, which also causes the slider to be hidden. This is a larger issue for those wanting to extend Core block support panels. It's almost like we need a check to see if other controls should be displayed, even if those controlled in theme.json are hidden. 🤔 |
This is what i thought when i'm dealing with it. But if i remember well, not every I tried each of those one by one and the first that worked is
Or detach "overlay" related controls to dedicated |
Thanks for the ping 👍 From memory, the overlay opacity was thought of as essentially part of the overlay color. It's effectively a shortcut to adjusting the color's alpha. If all color support is disabled, so to then was the overlay, which in turn affects the opacity control. The disabling of color support and the related panel is very awkward. No arguments here. It prompted me a while back to try and outline all the inconsistencies with disabling block support UIs. Unfortunately, I haven't had the bandwidth to address any of the tasks outlined in that issue. Personally, I'd probably lean towards keeping the tight coupling between the overlay color and its opacity. It's not a position I hold strongly though if there proves to be a demand for doing the opposite. You can find some further history and context in previous issues and PRs.
You can see in the Cover block's inspector controls where the overlay and overlay opacity controls are conditionally rendered. That condition is based on
I believe the block support panels, e.g color, typography etc, will show if there are any fills to render into them. It's why the issue linked above was raised when the thinking was that the overlay and opacity shouldn't be shown if colors were disabled. It is the cover block itself that omits the overlay controls from the panel not the panel or theme.json themselves. The theme.json settings are using by the block in making that determination though.
Given overlay isn't a feature within color block supports, I don't think this is a viable option. It's an ad hoc control added by the Cover block which doesn't apply to other blocks adopting color support. IIRC there has been some discussion in the past around allowing bespoke settings per block-type in the theme.json. It might have been around allowing button width to be disabled. If that feature was added, it might provide the mechanism to control display of ad hoc block controls. Hopefully, that helps provide a clearer picture of our current situation. Ultimately, I'm not sure if we can describe this as a bug. It might be best pivoted into a feature request for a different approach. What do you all think? |
Description
I don't know if it is supposed to work like this but i found it unintuitive.
If i disable the entire
settings.color
property, (notsettings.blocks.core/cover.color
) to prevent color usage this cause the core/cover to lose abilty to control the overlay opacity.Trying to reenabling it, it is necessary to enable
settings.blocks.core/cover.color.defaultGradients
.It doesn't make sense for me.
Step-by-step reproduction instructions
core/cover
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: