Skip to content

Setting 'parent' restriction in block API (block metadata) does not prevent the block from being transformed (wrapped) by group and column blocks. #66645

@wwdes

Description

@wwdes

Description

The parent block API is not being honored by the transform options "Columns" and "Group" (and "Details" with Gutenberg plugin 19.5.0). According to block API reference: "Setting parent lets a block require that it is only available when nested within the specified blocks."

Step-by-step reproduction instructions

Set a custom block's parent metadata key to a specific parent block:

{ "parent": [ "core/cover" ] }

In the editor, create the cover block and insert your custom block. While selecting your custom block, click on the button that has the blocks icon in the floating toolbar to get the transform options. There are seen buttons: "Columns" and "Group" (and "Details" with Gutenberg plugin 19.5.0). When user clicks either of them, the custom block is now wrapped within the corresponding block, bypassing the restriction set by the parent block API.

Screenshots, screen recording, code snippet

No response

Environment info

Tested on WP 6.6.2 without Gutenberg plugin as well as with Gutenberg plugin 19.5.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

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

    [Feature] Block TransformsBlock transforms from one block to another[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