Skip to content
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

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

Closed
ndiego opened this issue Sep 24, 2022 · 4 comments · Fixed by #44446
Closed

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

ndiego opened this issue Sep 24, 2022 · 4 comments · Fixed by #44446
Assignees
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@ndiego
Copy link
Member

ndiego commented Sep 24, 2022

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

@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Priority] High Used to indicate top priority items that need quick attention Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json CSS Styling Related to editor and front end styles, CSS-specific issues. labels Sep 24, 2022
@ndiego
Copy link
Member Author

ndiego commented Sep 24, 2022

@glendaviesnz @annezazu FYI.

@ndiego
Copy link
Member Author

ndiego commented Sep 24, 2022

A quick update after additional testing. This appears related to the new layout settings on container blocks. If you set "Inner blocks use content width" on the Group block, everything then works.

Editor:
image

Frontend:
image

The Column block obviously does not have this layout setting, so the issue still exists there. I guess that there is some conditional restricting the generation of the spacing step variables when this layout setting is not set 🤔

@annezazu
Copy link
Contributor

@tellthemachines might you have time to dig in here based on your work with that inner blocks width setting?

@tellthemachines tellthemachines self-assigned this Sep 26, 2022
@tellthemachines
Copy link
Contributor

Thanks for reporting this @ndiego! I can confirm there's a missing bit of logic that should convert the preset values into CSS custom properties, and will have a fix up soon.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Sep 26, 2022
pento pushed a commit to WordPress/wordpress-develop that referenced this issue Sep 26, 2022
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
markjaquith pushed a commit to markjaquith/WordPress that referenced this issue Sep 26, 2022
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
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this issue Sep 26, 2022
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
ootwch pushed a commit to ootwch/wordpress-develop that referenced this issue Nov 4, 2022
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
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants