-
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
Don't add root padding to children of flex and grid layout blocks. #53259
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/class-wp-theme-json-gutenberg.php ❔ phpunit/class-wp-theme-json-test.php |
Thanks for putting up this fix! I'm about to wrap up for the day, so just a quick drive-by comment: will we also need to factor in the grid layout type in the chained I can give this PR a proper test tomorrow! |
Size Change: +17 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
yes 😄 |
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.
This is testing great for me! While it is potentially a breaking change if there are templates that folks are using that expect these rules (e.g. full width Stack blocks), this change feels like the desired behaviour for how root padding should work, that is: it applies to children of flow and constrained layouts, and not flex or grid layouts 👍
Testing a full-width Row and Stack block, and that switching to flow layout in the Group block still results in root padding being applied correctly:
2023-08-03.10.43.03.mp4
For Grid or Flex layouts that wish to use the root padding, it's still possible for them to effectively do this via wrapping the blocks in a flow Group block:
2023-08-03.10.51.38.mp4
So, IMO this optimises for the more common use case (full width flex or grid is expected to be full width even if root padding is used), while not preventing folks from taking advantage of root padding via a more complex block structure (wrapping in Group if need be).
Looks good to try out in the plugin to me! ✨
Thanks for reviewing and testing @andrewserong! |
@carolinan I have tested it with the twenty twenty four and. I have personally conducted tests, and I'm pleased to report that everything is functioning as expected for me. |
What?
Fixes #52721 and #50861.
Modifies the root padding rules to not add root padding to children of full width flex and grid layout blocks.
This change means that there will now be no space between children of full width flex and grid blocks and edges of the window. It might mean adding some extra margin to the parent block if this is not the desired outcome, but that is probably better than having padding on every single child block, which throws off the block spacing.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast