-
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
Root padding collapsing unexpectedly #56229
Comments
Thanks for writing out this issue! Could you add some more info about which theme you're testing on, or, if it's a custom theme, what the settings of the Post Content block are? This is relevant because Post Content the alignment and layout type of Post Content will have an influence in the root padding of any blocks inside a post.
I'm not sure what you mean by "breaching" here. Is it the bullet on the List that's misaligned? |
Digging in a bit deeper on the front-end. I'm trying to pick apart this css selector and why it's applying correctly in some places and not in others. This is the wildest css selector I've ever seen ...
So, to attempt to translate ... In order to be targeted by this and get global padding, the block needs to be inside the post content block with Furthermore it needs to be inside a container (group, columns, media/text, cover) that ...
I think this means it has to be a group, or columns block in it's default state that is aligned full. and the element inside this container is itself ...
OR
OR any of the following elements p,h1,h2,h3,h4,h5,h6,ul,ol I think I got that right ... Inspecting my front-end I can see one issue right off the bat. If I toggle on I'm going to keep investigating and updating here. |
Ok, ignore my above explanation I had to consult Chat GPT to break this one down for me. The selector selects elements with the class It then looks for children of those whose class attribute contains "wp-block-" but does not include OR who has the class .wp-block but does not have the class .alignfull. (does this match anything?) OR is any paragraph, heading or list element. I think this is more accurate than what I wrote above. The commas and spaces in that selector are kinda hard to parse out. In any case, it seems like adding |
Ahhhh ok, I think I've got another real bug here. Knowing that toggling on |
Thanks for all the extra details @dabowman! From what I can see, the padding on that nested group is being removed by this rule, which resets padding for nested This might be fixable by excluding alignfull blocks from that rule. I can give it a try but anything we change here will have to be thoroughly tested to make sure we're not breaking anything else 😅 |
Hmm after looking into this a bit I don't think there's a way of targeting specifically The problem is that there's no way of telling the nesting level of a block or group of blocks, so given the following markup:
what works in this case if these blocks are at root template level - the nested group gets padding applied - doesn't work if they are in any context where the nested group isn't actually full page width, because in that case we wouldn't expect it to have padding. I also considered adding something like I hope this makes sense. The rules have become a bit mind-boggling because so many exceptions had to be added over time. |
Closing this out as it appears the questions have been asked and answered. With that said, I did want to note this effort for 6.6 to make root padding more consistent across the interfaces: #60715 Going forward, please open a new issue with more up to date info based on these recent changes and any new/current problems that remain. |
Description
Through some trial and error I think I've isolated why I've struggled with the rootPaddingAwareAlignments features that is supposed to help with managing the root application padding in regards to block alignment. Layout is a bigger conversation and I think there are a few issues here that bear discussing. But to keep this simple I think I've identified two situations in which this feature is behaving unexpectedly.
FIrst, If you group a set of blocks and that group has the combo of
"layout":{"type":"constrained"}
and"align":"full"
then its children will breach the root padding. The group here has a blue background.Second, if you group a set of blocks and that group has the combo of
"layout":{"type":"default"}
and"align":"full"
then it's direct children will respect root padding but other direct child groups and their children will breach root padding. The blue group here has a nested group with a gray background and you can see it's children breaching root padding.Step-by-step reproduction instructions
Set rootPaddingAwareAlignments to true
Add root padding in styles.spacing.padding
Group a set of blocks
Add
"layout":{"type":"constrained"}
and"align":"full"
check the preview at a narrow screen width.
set
"layout":{"type":"default"}
and add a nested group with any settings that contains blocks.check the preview at a narrow screen width
Screenshots, screen recording, code snippet
No response
Environment info
WP 6.4.1
PHP 8
wp-now env
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: