facebook / lexical

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

Bug: Can't continue typing in the editor when it has only horizontal rules nodes. #6775

Open metinhomsin opened 3 weeks ago

metinhomsin commented 3 weeks ago

This bug only found in Firefox browser, the version I use is Firefox 131.0.3 (64-bit).

Lexical version: 0.16.1, I also tried 0.19.0 still have this problem too.

Steps To Reproduce

  1. Open an empty editor and insert only one or few horizontal rules nodes in the editor. Screenshot 2024-10-28 155433

  2. Remove all paragraph nodes from the editor, by moving cursor inside each node and press Backspace. Now, the editor will have only horizontal rules nodes as shown in the picture below. Screenshot 2024-10-28 155514

  3. Make the focus outside of the editor and try to focus back in the editor again. We won't be able to type in the editor again.

Link to code example:

The current behavior

When insert only horizontal rules nodes in the editor and remove all paragraphs from it and make the focus outside of the editor and try to focus back to the editor again. We won't be able to type in the editor again.

The expected behavior

The user should be able to continue typing in the editor.

Impact of fix

Since this bug is easy to reproduce with only few steps, it may occasionally happen to some users using Lexical editor. But when this happen, users will have no idea what to do next to continue working with the editor.

I think this is a moderate bug because when the user just insert only one or few horizontal rules nodes and accidentally remove all paragraphs for any reason, they will encounter this bug and can't do anything in the editor.

potatowagon commented 3 weeks ago

https://github.com/user-attachments/assets/7f53017e-31c0-421f-a649-5bcb30b713cc

im still able to type after focusing outside the editor