-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Backport Fix spacing property generation in flow layout type #3324
Backport Fix spacing property generation in flow layout type #3324
Conversation
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 backporting this one @tellthemachines! This is working nicely in my local environment with the following test markup, and running TwentyTwentyTwo theme. Prior to this PR, the custom blockGap spacing for each of these columns is not rendered on the site frontend. With the PR, the CSS variable-based values are output correctly 👍
Test Columns markup
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|20"}}} -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>A paragraph</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Another paragraph</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|80"}}} -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>A paragraph</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Another paragraph</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
LGTM!
Self-assigning for commit review and prep. |
Test ReportEnv:
Test Instructions:
Test Columns markup<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|70"}},"backgroundColor":"primary"} -->
<div class="wp-block-group has-primary-background-color has-background"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|60"}},"backgroundColor":"primary"} -->
<div class="wp-block-column has-primary-background-color has-background"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|80"}},"backgroundColor":"primary"} -->
<div class="wp-block-column has-primary-background-color has-background"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column {"style":{"spacing":{"blockGap":"var:preset|spacing|30"}},"backgroundColor":"primary"} -->
<div class="wp-block-column has-primary-background-color has-background"><!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc tincidunt ex in eros ultrices hendrerit.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
Results:Summary:
Using TT2:The PHP Code's
Before applying the patch.wp-block-group.wp-container-7.wp-block-group.wp-container-7 > * + * {
margin-block-start: var:preset|spacing|70;
margin-block-end: 0;
} After applying the patch.wp-block-group.wp-container-7.wp-block-group.wp-container-7 > * + * {
margin-block-start: var(--wp--preset--spacing--70);
margin-block-end: 0;
} Using TT3:The PHP Code's
Before applying the patch.wp-block-group.wp-container-7.wp-block-group.wp-container-7 > * + * {
margin-block-start: var:preset|spacing|70;
margin-block-end: 0;
} After applying the patch.wp-block-group.wp-container-7.wp-block-group.wp-container-7 > * + * {
margin-block-start: var(--wp--preset--spacing--70);
margin-block-end: 0;
} |
Confirmed: This PR does fix the reported bug WordPress/gutenberg#44435 ✅
|
* Tests fail without the fix. * Tests pass with the fix.
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.
- Confirmed the bug exists prior to applying this code ✅
- Confirmed generates valid CSS with this code applied ✅
- Tests valid the bug (fail before apply the bugfix) and fix (pass after applying the bugfix) ✅
There 3 instances of the same gap value conversion code in this one function. These instances could be consolidated into a static function. However, as there was already 2 instances prior to this PR, refactoring is outside the scope of this PR. Will explore in a separate PR.
This PR is ready for commit. Prepping now.
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [WordPress/gutenberg#44435 Gutenberg issue 44435]. Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [#3324 Gutenberg PR 3324]. Also adds a test dataset that fails before the bugfix and passes after the bugix. Follow-up to [54274]. Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54311 602fd350-edb4-49c9-b593-d223f7449a82
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [WordPress/gutenberg#44435 Gutenberg issue 44435]. Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [WordPress/wordpress-develop#3324 Gutenberg PR 3324]. Also adds a test dataset that fails before the bugfix and passes after the bugix. Follow-up to [54274]. Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya. See #56467. Built from https://develop.svn.wordpress.org/trunk@54311 git-svn-id: http://core.svn.wordpress.org/trunk@53870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [WordPress/gutenberg#44435 Gutenberg issue 44435]. Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [WordPress/wordpress-develop#3324 Gutenberg PR 3324]. Also adds a test dataset that fails before the bugfix and passes after the bugix. Follow-up to [54274]. Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya. See #56467. Built from https://develop.svn.wordpress.org/trunk@54311 git-svn-id: https://core.svn.wordpress.org/trunk@53870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Merged via changest https://core.trac.wordpress.org/changeset/54311. Thank you everyone for your contributions in identifying and resolving this issue 🎉 |
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [WordPress/gutenberg#44435 Gutenberg issue 44435]. Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [WordPress#3324 Gutenberg PR 3324]. Also adds a test dataset that fails before the bugfix and passes after the bugix. Follow-up to [54274]. Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54311 602fd350-edb4-49c9-b593-d223f7449a82
Trac ticket: https://core.trac.wordpress.org/ticket/56467
Backports fix to block spacing from WordPress/gutenberg#44446
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.