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

Docs: Selection reconciliation & focus FAQs #6514

Closed
etrepum opened this issue Aug 12, 2024 · 0 comments · Fixed by #6894
Closed

Docs: Selection reconciliation & focus FAQs #6514

etrepum opened this issue Aug 12, 2024 · 0 comments · Fixed by #6894
Labels
enhancement Improvement over existing feature

Comments

@etrepum
Copy link
Collaborator

etrepum commented Aug 12, 2024

It's very common for new users to stumble with focus issues with the editor. The way that Lexical reconciles its selection to the editor should be documented.

We might also want to consider ways to control this more precisely and to detect that it shouldn't change.

A pretty common response to focus related questions:

This happens because the editor has a selection and when it updates the selection is reconciled to the DOM. The browser will always focus whatever is selected. You can either set the editor to not editable during this update, or set the selection to null

I think this issue is exacerbated by the fact that commands or registering plug-ins can cause the editor to be dirty and perform selection reconciliation even when it isn't obvious that it "should". Maybe a pair of update tags (or $functions that set editor state) to prevent or force selection change could help resolve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement over existing feature
Projects
None yet
1 participant