Skip to content

Bug: SELECTION_CHANGE_COMMAND is not triggered if the anchor and focus are on nodes of the same type #9179

Description

@levensta

Lexical version: 0.51.0

Steps To Reproduce

  1. Select a part of the text such that the anchor node and the focus node are located on an unformatted TextNode
  2. Press Backspace

Link to code example

The current behavior

SELECTION_CHANGE_COMMAND is not triggered in any browser. Note, however, that the command is dispatched if the selection boundary is located on a formatted text node or inside an inline node

selectionchange.in.partial.selection.mov

It has also been locally confirmed that the bug reproduces on version 0.50.0

The expected behavior

SELECTION_CHANGE_COMMAND is dispatched if a selection with boundaries is removed from any type of node

Impact of fix

Handlers tied to selection changes via a Lexical command do not receive the event, even though the selection has actually changed. Despite the specific conditions required to reproduce the bug, it appears that it may occur quite frequently

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions