Skip to content

Bug: Editor steals focus to other components when AutoLinkPlugin is present #5016

Open

Description

@emaborsa

Lexical version:

@lexical/react 0.10.0
lexical 0.10.0

as well with
@lexical/react 0.12.2
lexical 0.12.2

Link to code example:

https://codesandbox.io/s/lexical-editor-focus-problem-with-autolinknode-88md65

Steps To Reproduce

  1. start the sandbox
  2. type something in the first input (should work)
  3. type something in the second one, the lexical editor (should work as well)
  4. type something in the first input (focus should return to the editor)
  5. remove the AutoLinkPlugin on line 42 of Editor.tsx
  6. type something in the first input (should work)
  7. type something in the second one, the lexical editor (should work as well)
  8. type something in the first input (should work as well)

The current behavior

One input is a simple text field and the other one is the lexical editor. When typing into the first one, the focus returns to the lexical editor. This happens only if AutoLinkPlugin is present.

The expected behavior

If typing something in the first input field the focus should stay there.

Activity

  1. ipeterov commented on Apr 1, 2024

    @ipeterov

    I also encountered this issue - in my case it was causing cryptic scroll jumps. I have multiple editors in one page (they are a part of an infinite scroller), and the scroll was pinned to the bottom whenever new editors loaded in. The problem was caused by the last editor taking focus.

    I implemented a workaround until this gets fixed - I attached focus listeners to the _rootElement, and only enable the AutoLinkPlugin when a particular editor gets focused.

  2. ruxandra-anghel commented on Nov 7, 2024

    @ruxandra-anghel

    Plus 1, also discovered this issue

  3. added a commit that references this issue on Oct 21, 2026
    2e7427d
  4. Vedthakar commented on Oct 21, 2026

    @Vedthakar
    Contributor

    I opened #9425 to fix this: registering a transform no longer moves focus or the DOM selection into an editor that doesn't have focus, so AutoLinkPlugin re-rendering no longer steals focus from other inputs.

    — Ved Thakar

  5. added a commit that references this issue on Nov 16, 2026
    3280250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions