Bug: SELECTION_CHANGE_COMMAND is not triggered if the anchor and focus are on nodes of the same type
Author: levenstaCreated Sep 18, 2026Updated Sep 18, 2026
Lexical version: 0.51.0
Steps To Reproduce
- Select a part of the text such that the anchor node and the focus node are located on an unformatted TextNode
- Press Backspace
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
https://github.com/user-attachments/assets/3cff8057-5c8f-4361-ab54-6dc039b198f0
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
Source: facebook/lexical