Skip to content

Deleting first item in an InnerBlocks list with delete key causes exception #29498

@glendaviesnz

Description

@glendaviesnz

Description

If the delete key or keyboard shortcut is used to delete the first item in an InnerBlocks list an exception is thrown. Using the 'Remove block' menu option for the block works as expected. Using the delete key for any block other than the first one also works as expected.

This issue can be replicated with the Navigation block, and also on the gallery block refactor PR

Step-by-step reproduction instructions:

  1. Add a Navigation block and add several child navigation items to it.
  2. Select the first item in the navigation and hit delete key to remove
  3. Block shows unable to preview message and exception in console

deletekey

Code snippet

Exception is thrown at https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/block-list/use-block-props/index.js#L86

For some reason the useBlockProps hook for the block that has been deleted gets stuck in a loop and throws an exception when trying to get the title of the block that is now deleted.

Metadata

Metadata

Assignees

Labels

[Feature] Block APIAPI that allows to express the block paradigm.[Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P[Priority] HighUsed to indicate top priority items that need quick attention[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