You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, offset 1 and 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.
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.
The text was updated successfully, but these errors were encountered:
Can you be more specific about how exactly you're creating this element selection? With Chrome 131.0.6778.205 on macOS 15.2 I can only get it to land on text points for both anchor and focus with either mouse or keyboard selection.
Hmm it seems like this might be an issue on Firefox only. I tested right now on Chrome and Safari and was not able to replicate.
On Firefox, I'm able to replicate in a few ways:
Select from the end of the link to middle using either keyboard or mouse (anchor will be element)
Select from middle of link to the end using mouse (focus will be element)
Select from middle of link to the first character of the sibling and then back to the end of the link using either keyboard or mouse (focus will be element)
I'm also able to get it to happen at the start of the link if I select from the start to the middle using the keyboard. But that doesn't seem to affect deletion in a negative way.
Firefox: for whatever reason this selection movement creates a point that is not normalized in the same way as other browsers (normally the point would normalize to text)
Lexical version: 0.21.0
Steps To Reproduce
element
, offset1
and 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.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.
The text was updated successfully, but these errors were encountered: