facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
19.67k stars 1.67k forks source link

Bug: Shift+down selects an extra subsequent element #6527

Closed serey-roth closed 3 weeks ago

serey-roth commented 2 months ago

https://www.loom.com/share/78508267145b422081498fe08c461626?sid=13463229-4383-4ec6-80d2-741805a691c7

Lexical version: 0.17

Steps To Reproduce

  1. Insert a paragraph with some text.
  2. Insert a 2x2 table.
  3. Delete the preceding paragraph.
  4. Insert a paragraph after the table, with some text.
  5. Press "Shift+Down arrow" at the end of the first paragraph.

The current behavior

Both the table and the second paragraph are selected.

The expected behavior

Only the table should be selected.

Impact of fix

ivailop7 commented 2 months ago

I CAN reproduce this issue with a Table, Page Break, Divider, Collapsible Section, I CANNOT reproduce with Excalidraw, Poll, Image. It's not tables specific, so I can confirm it's not TableSelection specific, it's much lower down the selection stack.

ivailop7 commented 2 months ago

Would be nice to get @etrepum 's view on this one as well, to me it seems like a quite significant selection issue.

etrepum commented 2 months ago

Tbh I think selection has a lot of broken edge cases when it's not a RangeSelection of text. Haven't recently taken a close look at any of them.