Skip to content

Bug: Editor becomes uneditable when a block DecoratorNode is the only root child #8525

@mayrang

Description

@mayrang

Lexical version:
0.44.0 (latest main, commit e65fcd7)

Steps To Reproduce

  1. Open https://playground.lexical.dev/
  2. Insert a block DecoratorBlockNode (e.g. YouTube via the slash menu, URL like https://www.youtube.com/watch?v=dQw4w9WgXcQ)
  3. Remove the paragraph above the decorator (Backspace at the paragraph start) so the block decorator becomes the only root child
  4. Click the decorator so it is focused as a NodeSelection (a focus ring appears)
  5. Press Enter

Link to code example: https://playground.lexical.dev/

The current behavior

Nothing happens. The KEY_ENTER_COMMAND handler registered by registerRichText bails out at the $isRangeSelection(selection) guard — for a NodeSelection it just returns false. There is no paragraph to type into, and the keyboard has no way out of the NodeSelection state.

2026-05-18.4.21.26.mov

The expected behavior

A new empty paragraph should be inserted after the decorator and the caret should land in it, so the user can keep typing — matching the common pattern in other editors where pressing Enter on a selected block creates a new line below it.

Impact of fix

Whenever a user removes the surrounding paragraphs of a block decorator (image, YouTube, etc.), the editor becomes uneditable from the keyboard. The fix is small (a NodeSelection branch in the rich-text Enter handler) and unblocks an otherwise common state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions