Skip to content

Docs: Selection reconciliation & focus FAQs #6514

@etrepum

Description

@etrepum

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement over existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions