Skip to content

Block Gap: supplying a variable does not work in the view #39583

@jffng

Description

@jffng

Description

If I supply a CSS variable value to the blockGap attribute for a block that supports gap, it is not respected in the view. It does in the editor.

Step-by-step reproduction instructions

  1. Using Twenty Twenty-Two, add the following markup containing a navigation and group (row) block using a CSS variable for blockGap:
<!-- wp:navigation {"ref":160,"style":{"spacing":{"blockGap":"var(\u002d\u002dwp\u002d\u002dcustom\u002d\u002dspacing\u002d\u002dsmall)"}}} /-->

<!-- wp:group {"style":{"spacing":{"blockGap":"var(\u002d\u002dwp\u002d\u002dcustom\u002d\u002dspacing\u002d\u002dsmall)"}},"layout":{"type":"flex","allowOrientation":false}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>First item in the row</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Second item in the row</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
  1. Check the editor, verify the variable values are respected:

Screen Shot 2022-03-18 at 11 03 55 AM

  1. Check the front-end, verify it falls back to the default blockGap value:

Screen Shot 2022-03-18 at 11 03 16 AM

Screenshots, screen recording, code snippet

No response

Environment info

  • WP 5.9.2, Gutenberg trunk

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

Assignees

No one assigned

    Labels

    CustomizationIssues related to Phase 2: Customization effortsNeeds TestingNeeds further testing to be confirmed.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions