Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Should not focus on root element #5968

Open
aquarius-wing opened this issue Apr 26, 2024 · 2 comments
Open

Bug: Should not focus on root element #5968

aquarius-wing opened this issue Apr 26, 2024 · 2 comments
Labels
contribution-week Issues that are good to be picked up for the contribution week

Comments

@aquarius-wing
Copy link

aquarius-wing commented Apr 26, 2024

Lexical version:

Steps To Reproduce

  1. Open Playground
  2. Remove all text and type ``` and space key
  3. Type some text like 11111
  4. Press Arrow Up Key multiple times
CleanShot-2024-04-26-at-17.37.29.mp4

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

@StyleT
Copy link
Contributor

StyleT commented Apr 26, 2024

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

@StyleT StyleT added the contribution-week Issues that are good to be picked up for the contribution week label Apr 26, 2024
@aquarius-wing
Copy link
Author

aquarius-wing commented Apr 27, 2024

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.

CleanShot-2024-04-27-at-10.49.49.mp4

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).

Example

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution-week Issues that are good to be picked up for the contribution week
Projects
None yet
Development

No branches or pull requests

2 participants