Skip to content

Spacer: Spacer blocks in Row/Stack layouts may break when upgrading from WP 6.7 #69414

@t-hamano

Description

@t-hamano

Description

In #68819, the save function was updated to not break blocks when deleting height, saving, and reloading the browser.

This appears to have affected backwards compatibility in certain contexts. For example, one pattern in Twenty Twenty-Five is affected and will result in a browser console error when you open the Patterns screen in the site editor.

Step-by-step reproduction instructions

This issue can be reproduced in two ways.

Insert a spacer inside the Row/Stack block

  • Update your local WordPress version to 6.7 and disable the Gutenberg plugin beforehand.
  • Insert a Row or Stack block. Insert a Spacer block inside it.
  • Change "Width" to "Fill".
  • Save the post.
  • Activate the Gutenberg plugin.
  • Open the post.
  • Verify that the Spacer block is broken.
f9e7feaa44062b27dab19bc7ec1711cb.mp4

Issue in the Twenty Twenty-Five theme

b99c8a2f31fe77ced04baab3e8741936.mp4
logger.js:17 Block validation: Block validation failed for `core/spacer` (
{name: 'core/spacer', icon: {…}, keywords: Array(0), attributes: {…}, providesContext: {…}, …}
).

Content generated by `save` function:

<div style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20);height:100px" aria-hidden="true" class="wp-block-spacer"></div>

Content retrieved from post body:

<div style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)" aria-hidden="true" class="wp-block-spacer"></div>

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

    Backwards CompatibilityIssues or PRs that impact backwards compatability[Block] SpacerAffects the Spacer Block[Status] In ProgressTracking issues with work in progress[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