Open aquarius-wing opened 2 weeks ago
Hi!
Thanks for noticing this. IMO it actually shall stick to root
and stay there. Why? How else can you insert something before that code block? :)
Also cursor shall be placed before code block
It's turely work when we want to add text before code block, but it doesn't clear to tell user "now we can insert text before code block!" when focus the root element. Because it seems exactly the same.
In my situation, my solution is when user pressing arrow up key, it will insert a paragraph before directly.
https://github.com/facebook/lexical/assets/16633962/f577fb46-cbef-4a32-a017-9307aa96c3ab
Speaking of which, why do I raise this question? It's to ensure that the focus can be correctly disengaged at the beginning of my editor (not the application shown in the video above).
It's like we have a form, which has input , and a lexical editor, I want the user to be able to navigate between them by pressing the up arrow key.
However, the behavior differs when we focus on the code block, quote and offset is set to 0, it will make the code I write become complex, I believe this is an area that could be improved.
So I suggest, the selection can not be switch to the root element.
Lexical version:
Steps To Reproduce
https://github.com/facebook/lexical/assets/16633962/25e84327-c799-4e6a-a178-0455c8520f82
The current behavior
You'll notice that the selection switches back and forth between the text node and the root node
The expected behavior
Just focus the text node only