Skip to content

Inserter should show blocks if parent or ancestor corresponds to currently edited entity #73827

@ockham

Description

@ockham

Description

If a block has its parent or ancestor property set in block.json, it won't be show in the inserter unless the inserter is called from a location inside one the blocks listed in either property. For example, if a block has "ancestor": [ "core/template-part" ], it will only be shown in the inserter when inside a Template Part block.

OTOH, if the editor is used to edit a Template Part entity, that block will not be shown in the inserter. The reason is that techncally, there's no actual Template Part block present in the block hierarchy. This should be fixed to show the block, as it's probably what most users will expect.

This isn't limited to Template Parts but also other entities that have a corresponding block type, e.g. Navigation, etc.

Step-by-step reproduction instructions

TBD. For now, refer to these two comments please: #73724 (comment) and #73724 (comment).

Screenshots, screen recording, code snippet

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

    [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