-
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
Layout: Fix issue with fallback gap styles where gap was being output for constrained layout type #44001
Layout: Fix issue with fallback gap styles where gap was being output for constrained layout type #44001
Conversation
… for constrained layout type
Size Change: 0 B Total Size: 1.25 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! It's working well in testing and I can see that :where(.is-layout-constrained > *){margin-block-start: 0;margin-block-end: 0;}:where(.is-layout-constrained > * + *){margin-block-start: 0.5em;margin-block-end: 0;}
are no longer output in the inline global styles.
Thanks for reviewing! |
What?
Ensure that fallback gap styles are only output for the
flex
layout type, so that in Classic themes (or themes that do not opt-in to block gap) we do not output the gap styles for the constrained layout type.Why?
In #42763 we didn't factor in that the existing logic for fallback gap was outputting fallback gap styles for layout types that are not default. Because the constrained layout type behaves in much the same way as the default layout type, we need to update the logic for the fallback gap so that it only applies to the flex layout type. The reason the fallback exists is primarily so that blocks like Buttons, Social Icons, and Columns render with a pleasing default gap. Vertically oriented blocks using the default and constrained layout types do not need the same kind of fallback gap to be output.
How?
Update the checks for default layout type that skip block gap output to instead be "not
flex
" instead.Testing Instructions
Here is some test markup for looking at blocks within a constrained layout type:
Test markup of paragraphs in a group block
In a Classic theme, prior to this PR, note that low specificity vertical gap (top margin) styles are being output in the editor (and also on the front end, but usually they're overridden by something with higher specificity).
With this PR applied, the constrained layout gap rules should no longer be output.
With blocks-based themes that use block gap (e.g. TwentyTwentyTwo), the gap should be the same as prior to this PR.
Screenshots or screencast