Skip to content

Unexpected auto-scrolling behavior when refocus the editor #5826

Open
@ederzz

Description

@ederzz

Description
The editor has rendered a long-text, when i make it blured, and refocus the editor it occurs a auo-scroll behavior.It is unexpected.It seems the dom-selection hasn't change when enter the code logic: code link

Recording

Image

Sandbox
https://codesandbox.io/p/sandbox/n8tm84

Steps
To reproduce the behavior:

  1. Go to sanbox
  2. Click on top line of editor
  3. Click outer, make editor blured.
  4. Scroll down to the end line of editor
  5. Click on editor, make it focused, then occurs auto-scroll

Expectation
I think the auto-scroll behavior shouldn't occur, because i have selected a new postion.

Environment

  • Slate Version: latest
  • Operating System: MacOs
  • Browser: Chrome

Context
After reading the source code, i found that when the code runs into function setDomSelection, neither the Slate selection nor the DOM selection updates to where I clicked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions