Skip to content

Empty rules are generated when using blockGap: null; in theme.json #71527

@emiliodom

Description

@emiliodom

Description

--wp--style--block-gap: ; and margin-block-start: ; are generated for .wp-site-blocks) when using blockGap: null; in theme.json, this results in the w3c validator showing a CSS error

Image

Step-by-step reproduction instructions

  • set blockGap: null; in theme.json on settings section
  • add a few blocks to a post or page, like calendar and search
  • open the page/post
  • check the inline styles in global-styles-inline-css
  • the css rule is generated with an empty value: :where(.wp-site-blocks) > * { margin-block-start: ; margin-block-end: 0; }

Screenshots, screen recording, code snippet

Image

Environment info

  • WordPress 6.8
  • Gutenberg 21.5
  • Theme 2025

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

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] Code QualityIssues or PRs that relate to code quality

    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