-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
6.6 - Paragraphs with has-background
have their automatic background overridden by global styles block padding
#63164
Comments
Looking at this code, are the changes in WP6.6 intentional? gutenberg/packages/block-library/src/paragraph/style.scss Lines 41 to 44 in 2c5f768
|
Thanks for the ping @t-hamano 👍 I discussed this problem with @talldan, @ramonjd, @tellthemachines, and @andrewserong before this issue was created. The description captures the dilemma in a nutshell. Unfortunately, at this stage, I don't have any solutions to it 😢 The general direction and thinking to date has been that global styles should override block library styles. This is the case in WP6.6 currently and has been in Gutenberg for a few releases now.
In my view, this is a bug. It also requires theme authors to bump their own styles' specificity higher again to overcome it.
IIRC the global styles referred to here are both any explicitly assigned to the block type and global padding. If it is padding explicitly assigned to a block type in global styles, it probably should override the arbitrary default applied by What is a real problem here, is a possible change in padding for existing sites where their theme relies on the core
The current behaviour in 6.6 makes the most sense to me also. I'm not sure how we can mitigate the downside though other than communicating it.
Bumping the specificity of Any bump in specificity may negatively impact the extended block style variations and the section styles feature which relies on uniform specificity so sections can be nested within each other e.g. creating pricing tables within a parent section. Prior to 6.6, variation padding styles in global styles would override the I'd love to hear others' thoughts on the best path forward from here. |
In my opinion this is how it should work. WordPress should honor the theme's choice over its own opinionated styles. Allowing theme devs to style globally is a strong argument. However, backwards compatibility in this case appears difficult. I can't think of any deprecation/CSS/block parsing trickery that would circumvent the direct conflict, which means that there could be one 😄 The ac911ae#diff-e13c67a8237605dbed9b6b676c56f4f9a7c75fe9c4117f623400ee09f5bd6a9fR17 Is there a case for deprecation? How would that look? Maybe it's worth advertising it in the Make Core blog and other channels - more ideas might surface. Sorry, I know that's not very helpful. |
This is a tough one, good discussion, folks! For this, I lean slightly toward the idea that global styles not overriding the paragraph block's Since there's a question of what should happen for WP 6.6, I'll just ping @ellatrix for visibility, as it sounds like a decision needs to be made on whether to stick with the current behaviour in |
Description
This probably applies to other blocks too, and is a result of levelling css specificity.
In 6.4 & 6.5, the automatic padding applied to blocks when they have a background (
.has-background
) overrides global styles padding rules for blocks.In 6.6, it's the other way around, global styles overrides the
.has-background
class due to a reduction in specificity.I'm not sure what the correct behavior is, possibly what 6.6 does makes the most sense.
I'm also not sure that it's possible to go back to how it worked in 6.5 without bumping specificity, which might cause other issues.
Step-by-step reproduction instructions
1.25em 2.375em
.1px
.Screenshots, screen recording, code snippet
6.4/6.5:
6.6:
Environment info
Mac OS / Brave
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: