Skip to content

Navigation block with no defined block gap doesn't render properly in the editor #54994

@properlypurple

Description

@properlypurple

Description

If a theme defines a navigation block without any block gap defined, it should inherit the default block gap, and render that in the editor and the frontend. Since Gutenberg 16.7.0, the gap doesn't render in the editor.

Step-by-step reproduction instructions

  1. Start with a fresh site on the 2023 theme, without the Gutenberg plugin
  2. Go to Appearance > Editor, and observe the navigation
  3. Install and activate Gutenberg 16.7.
  4. Go back to Appearance > Editor and observe the navigation.

Screenshots, screen recording, code snippet

In versions before 16.7.0, this css is being applied to the navigation in the editor

.wp-block-navigation .wp-block-page-list, .wp-block-navigation__container, .wp-block-navigation__responsive-close, .wp-block-navigation__responsive-container, .wp-block-navigation__responsive-container-content, .wp-block-navigation__responsive-dialog {
  gap: inherit;
}

And

.editor-styles-wrapper {
  --wp--style--block-gap: 1.5rem;
}

These are not present in Gutenberg 16.7.0. The frontend is unaffected in both cases.

Screenshot with Gutnberg 16.6
image

Screenshot with Gutenberg 16.7
image


Please note that this is not observable if the theme specifies a custom block gap for the navigation block like this

<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"},"style":{"spacing":{"blockGap":"1.5rem"}}} /-->

Environment info

  • WP 6.3.1
  • Gutenberg 16.7.0

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

    CSS StylingRelated to editor and front end styles, CSS-specific issues.[Block] NavigationAffects the Navigation Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions