-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Try: Fix nesting container margin smarts. #25527
Conversation
Size Change: -52 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
Looks like someone beat me to it and the fix in #25518 also fixes this issue. |
Well, sort of: The appender still gets shown when you select the block, as it should. Which means it becomes the last-child when the block is selected. In comparison, here's this branch: The change in this branch, even if it isn't as smart when it comes to paddings, still feels like the more resilient and predictable behavior for me. |
I disagree, I think we should keep the style unless we remove all the margins, otherwise the behavior is inconsistent. for example, if you test this PR in 2021 theme, you'll notice the margin jump is still there. |
Testing more, I'm not reproducing the issue in 2021 anymore, let me think this through. |
So I think ideally we find a selector that says "last block"/"first block" excluding any extra divs. I'm not able to do that right now for some reason. The reason I think this is important because these margins are going to interfere with paddings applied to the Group block. Say you define a custom small padding to your group block, the padding on the bottom/top won't be correct because the margins will apply there. I'm ok with this though until we find a better way. |
You're a man of reason, Riad. I agree with you on a human level even if occasionally we have separate approaches on the superficial level. Thanks for all your in depth thoughts on this. |
In #24966 (comment) padding support was added to the group block. As part of that, the first and last child of child blocks had their top and bottom margins zeroed out. The intention was noble: to make the padding act more predictably in a world where margin collapsing is a nightmare hellride to understand.
However it had a side effect — the group has an appender block at the end, which grabs that bottom margin rule, unless an adjacent block is selected:
This PR removes that rule, which although the intent was noble, it has consequences. The rules of margin collapsing really are weird and unpredictable, but I worry that trying to outsmart them we'll eventually create so many edgecases that it just ends up adding complexity. Here's after:
Yes I know, my in development theme has crazy tall margins: