-
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
Global padding: ".wp-block-block" class references in CSS selectors force padding to 0 in nested Group blocks #62597
Comments
Hi, it seems that the CSS rule:
was changed to
As a result, Left and Right padding values of nested Group blocks with "Inner blocks use content width" option, and Align Wide or Full width, are no longer reset to 0. The width of the inner content is no longer the same. Step-by-step reproduction instructions
|
There is actually a block, called "block" internally, which would correctly result in the classname I'm not up to date on how global or root padding is supposed to work at the moment so others might be better placed to comment there. |
I can confirm that the use of The change to global padding logic happened in #60715; we might need @richtabor to confirm whether this effect was intended or not. |
Thanks for the clarification @aaronrobertshaw @tellthemachines, so the selector is fine. But then there's still a difference between WP 6.5.4 and WP 6.6 beta 3 (with #60715 merged). You can test this pattern in a page on a WordPress with the TT4 block theme (page template has a Post Content block with the "Inner blocks use content width" option enabled) :
On WP 6.5.4, inner group got padding thanks to this rule:
On WP 6.6 beta 3, inner group got padding reset thanks to this rule:
This change is likely to break content integration when sites are updated to the latest version of WP. For some sites, this will mean updating a large amount of content to correct block settings. |
I believe this was a bug. You'll notice that adding an Image block to the inner Group and setting it to full width, the Image won't in fact be full width in the front end: ![]() and as @richtabor mentioned above, that padding didn't appear in the editor either. I'm looking into possible fixes for this but it's proving hard to change anything in these rules without other unwanted side-effects 😅 |
@fabiorubioglio I believe it is intended, because a rule was added that explicitly excludes wide aligned blocks from having their padding removed. |
Description
WordPress 6.6 and Gutenberg plugin in latest version have global padding CSS selectors including references to a
.wp-block-block
class, in.has-global-padding :where(.has-global-padding:not(.wp-block-block, .alignfull, .alignwide))
for example.I don't think
.wp-block-block
is a class used either in the editor or in the front-end. Wouldn't that be a mistake? It seems to me that it should refer to the.wp-block-group
class instead.As a result of what appears to be an error, nested "Group" blocks have their internal margins reset to 0.
I detail the procedure to reproduce the bug below.
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: