Skip to content

Section Styles not rendering "spacing.blockGap" values #63273

@bacoords

Description

@bacoords

Description

When registering a block style variation (i.e. section style), the "blockGap" value isn't being output in the editor or on the front end. Other spacing values are working ("spacing.padding", "spacing.margin").

This is particularly useful in a number of blocks with flex layout options (column, group, navigation) and works when added as a value to the block in theme.json (styles.blocks) but not when added to a section style.

Step-by-step reproduction instructions

Add a new section style JSON file to your theme's /styles/ directory:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 3,
	"title": "Footer Nav 1",
	"slug": "navigation-footer-1",
	"blockTypes": ["core/navigation"],
	"styles": {
		"spacing": {
			"blockGap": "var:preset|spacing|60"
		}
	}
}

This doesn't work.

However, adding this to your theme.json:

	"core/navigation": {
		"spacing": {
			"blockGap": "var:preset|spacing|80"
		}
	}

works fine.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.6-RC2
  • Gutenberg 18.7.1

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

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] BugAn existing feature does not function as intended

    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