-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: Selecting text in a link to/from the end of the link and deleting deletes the text that is not selected #6991
Copy link
Copy link
Closed
Labels
Description
Lexical version: 0.21.0
Steps To Reproduce
- Have a link node with a single text node, and another text node as the next sibling of the link node.
- In the link, select text from the middle to the end or vice-versa. Either the anchor or the focus should have type
element, offset1and key of the link node. This can be achieved by starting the selection from the middle then selecting the first character of the next text node and then back to the end of the link, or by starting the selection from the end of the link's text node. - Press backspace or delete to delete the characters
It doesn't seem possible to get the selection into this state if the link node has multiple child text nodes or if the link node does not have a text node sibling next to it.
Link to code example: https://playground.lexical.dev (as of 23rd dec)
The current behavior
Pressing backspace or delete causes the text which is not selected to be deleted and the selection to be collapsed at the start of that text node.
lexical-link-text-deletion.mov
The expected behavior
Only the text that was selected should be deleted.
Impact of fix
This affects any user that tries to delete text at the end of a link and isn't careful about overselecting text initially. If the user starts selecting from the end of the link, then this happens even without overselecting from the sibling text node.
Reactions are currently unavailable