-
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
Layout: Fix has-global-padding classname for constrained layouts without contentSize #43689
Layout: Fix has-global-padding classname for constrained layouts without contentSize #43689
Conversation
Size Change: +7 B (0%) Total Size: 1.24 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 so much for the quick fix!
This is working great for me. I've walked through the testing steps:
- With
settings.useRootPaddingAwareAlignments
set to false, I do not see thehas-global-padding
class for the group block:
- With
settings.useRootPaddingAwareAlignments
set to true and the inner blocks set to respect the content width (constrained layout type), I can see thehas-global-padding
class:
- With
settings.useRootPaddingAwareAlignments
set to true and the inner blocks set to not respect the content width, I do not see the class:
I tested the above using Twenty Twenty-Three and this PR.
I can confirm that I am getting the same results as @mikachan. Thanks @andrewserong for getting this together so quickly 🙌 |
LGTM! |
Thanks for the reviews, folks! I've just merged. @MaggieCabrera it looks like you're managing the current Gutenberg release? @bgardner mentioned above that it'd be good to try to get this one in for 14.0, but I wasn't sure if there's still time to cherry pick this one in. (I'm travelling at the moment, so am a bit limited time-wise, but otherwise I'd normally jump in to help out with the cherry-picking! 🙂) |
Yes, I'm adding this to the release, don't worry |
Excellent, thank you Maggie! 🙇 |
…out content size (#43689)
Apologies, all, I just realised that I should have added an |
What?
Fixes #43673
For the constrained layout type, if
settings.useRootPaddingAwareAlignments
is set totrue
then ensure thathas-global-classname
is always output irrespective of whether or notcontentSize
is explicitly set.Why?
Prior to the introduction of the constrained layout type, there was always a
contentSize
value if content sizes were in use — however with the new constrained layout type, if no value is set, then it defaults to outputting rules using the global CSS variable, so the logic for when to output thehas-global-padding
classname needed to be updated.How?
layout.php
always outputhas-global-padding
if the inferred layout type isconstrained
and the root padding aware alignments flag is set totrue
layout.js
update the logic for outputtinghas-global-padding
to include aconstrained
layout type check.Testing Instructions
settings.useRootPaddingAwareAlignments
tofalse
and ensure that thehas-global-padding
classname is not output for the Group block, irrespective of whether or not it has a contentSize appliedsettings.useRootPaddingAwareAlignments
totrue
, and so long as theInner blocks respect content width
toggle is switched on (the constrained layout type is in use), then thehas-global-padding
classname should be output, irrespective of whether or not a customcontentSize
is providedScreenshots or screencast
With this PR applied, classnames should be output as expected: