-
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 where layout classnames are injected for blocks without layout support #56187
Layout: Fix issue where layout classnames are injected for blocks without layout support #56187
Conversation
… blocks without layout support
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/block-supports/layout.php |
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.
Before
<div class="wp-block-group is-nowrap is-layout-flex wp-container-core-group-layout-4 wp-block-group-is-layout-flex">
<p>Paragraph 1</p>
<p class="is-layout-flow wp-block-paragraph-is-layout-flow">Paragraph 2</p>
<p>Paragraph 3</p>
</div>
After
<div class="wp-block-group is-nowrap is-layout-flex wp-container-core-group-layout-4 wp-block-group-is-layout-flex">
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
</div>
🍺
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.
Can confirm exactly the same as Ramon above 👍
Thanks for the reviews! |
Thanks for fixing this! |
Backport open in WordPress/wordpress-develop#5900 |
✅ I updated this PR with the |
What?
This resolves an issue found while testing #56130 (review) — if a child of a Row block is explicitly set to
Fit
then layout classnames are erroneously injected for blocks that do not support layout (e.g. a paragraph block set to Fit as a child of the Row block).Why?
Layout classnames should not be output for blocks without layout support. They were being injected because we didn't have an early return condition for if a block has
selfStretch
set, doesn't have layout support, but does not generate any styles.How?
Following the condition for outputting the outer wrapper classname for
selfStretch
rules, perform an early return if the block does not support layout.Testing Instructions
trunk
extra layout classnames are injected into the paragraph block.wp-container-content-x
classname and associated styles.Test markup:
Screenshots or screencast
Before
After