Skip to content

Spacing step variables not getting generated properly with Block Spacing #44435

@ndiego

Description

@ndiego

Description

When applying Block Spacing to various blocks using the new spacing steps, often the variable is not generated correctly. Switching to manual spacing works as expected. This was tested using 6.1 and Gutenberg trunk. The same issue occurs without Gutenberg active.

Step-by-step reproduction instructions

  1. Use the TT3 theme or a similar theme that support spacing steps.
  2. Add a Group block with two paragraphs inside of it.
  3. Configure Block Spacing using the steps provided by the theme
  4. Editor looks fine, but view on the frontend and see that the step variable is not generated correctly.

Sample code for replicating (using TT3):

<!-- 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 -->

Screenshots, screen recording, code snippet

Editor View:
image

Frontend View:
image

Error:
image

Environment info

  • WordPress 6.1 Beta
  • Gutenberg Trunk
  • Twenty Twenty-Three

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Labels

CSS StylingRelated to editor and front end styles, CSS-specific issues.Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions