Skip to content

FIX: Unexpected auto-scrolling behavior when refocus the editor (issue: 5826) - #5882

Open
renasami wants to merge 4 commits into
ianstormtaylor:mainfrom
renasami:fix/5826-editable-onBlur
Open

FIX: Unexpected auto-scrolling behavior when refocus the editor (issue: 5826)#5882
renasami wants to merge 4 commits into
ianstormtaylor:mainfrom
renasami:fix/5826-editable-onBlur

Conversation

@renasami

@renasami renasami commented May 24, 2025

Copy link
Copy Markdown

Description
Fixed an issue where the editor would scroll to the previous focus position when rendering long text.

Issue
Fixes: 5826

Example
Current behaviors

2025-05-25.2.06.23.mov

Fixed behaviors

2025-05-25.2.01.34.mov

Context
It was missing scroll logic to the new caret position.

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

@changeset-bot

changeset-bot Bot commented May 24, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cf6b5ad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@virgil1996

Copy link
Copy Markdown

I don’t think this is a safe fix.

Calling el.focus({ preventScroll: true }) inside onBlur effectively cancels the blur. In practice, this makes the editor unable to lose focus, and when the user tries to focus another input element, focus is immediately stolen back by the editor.

That is a significant behavioral regression: clicking outside the editor, focusing toolbar inputs, dialogs, forms, or any other focusable control should be allowed to move focus away from the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected auto-scrolling behavior when refocus the editor

2 participants