facebook / lexical

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

Bug: Cursor jump to the end of the document when a collaborator deletes focusing paragraph #5974

Open matsuyama-k1 opened 2 weeks ago

matsuyama-k1 commented 2 weeks ago

Lexical version: 0.14.5

Steps To Reproduce

  1. Launch the Playground in collaboration mode
  2. Open two windows (A and B)
  3. In window A, select a line
  4. In window B, delete the line that is selected in window A
  5. The focus in window A moves to the end of the document

The current behavior

In the video, cursor in the right window jump to the end of the document when the paragraph is deleted from the left window. This issue forces the cursor to the end of the editor during collaborative editing, which disrupts smooth editing experience.

https://github.com/facebook/lexical/assets/111737064/2cfd5dcf-edf4-4297-878d-7cb438141634

The expected behavior

The cursor should not move to the end of the document when the collaborator deletes focusing paragraph.

matsuyama-k1 commented 2 weeks ago

I already have a solution

ivailop7 commented 2 weeks ago

Nice find!