Skip to content

Bug: Editor is focused when the initialConfig editorState converts from markdown and registerNodeTransform has been used #4474

@darsee

Description

@darsee

In the codesandbox linked below, the editor is focused on mount when the initialConfig editorState converts a markdown heading and registerNodeTransform has been used. Is this expected?

Lexical version: 0.10.0

Steps To Reproduce

  1. Open the codesandbox below
  2. Observe that the editor is initially focused (cursor is visible)
  3. Change value to test (uncomment line 27)
  4. Reload the browser preview, observe that the editor is not focused (cursor is not visible)
  5. Change value back to # test and comment out <TestPlugin />
  6. Reload the browser preview, observe that the editor is not focused (cursor is not visible)

Link to code example:

https://codesandbox.io/s/lexical-editor-focused-after-node-transform-sfm1wn?file=/src/Editor.js

The current behavior

On reloading the browser preview, the editor is initially focused (cursor is visible).

The expected behavior

I expect the editor not to be initially focused unless using @lexical/react/LexicalAutoFocusPlugin?

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreReconciler, DOM, Selection, Node, Events, Compositiondiscussionmarkdown

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions