Skip to content

Scroll bar jumps element editing off the screen #4589

@thedarkamendez

Description

@thedarkamendez

Description

When modifying block quotes, and editing the document by following the instructions in the reproduction steps, the editor scroll ups to the top 25% of the document and moves whatever you were editing before off the screen. Take a look at the video to see the reproduction of the bug:
https://github.com/user-attachments/assets/ba076549-9122-46f6-a729-93c5122d325f

Here are the steps to reproduce:

  1. Go to https://platejs.org/editors
  2. Scroll down to 'A Notion-like AI template'
  3. Then scroll down to the block quote at the bottom of that editor.
  4. In the middle of the sentence, hit enter once, then move the cursor back up to the point where you hit enter before and hit enter again.
  5. You should see the editor scroll to the top 25% of the document leaving the content you were editing off the screen.

Note: simply hitting enter twice does not reproduce the issue. You have to go to the middle of a sentence, call this Point A, then hit enter. Then go back up to Point A and hit enter again.

Additional Note: I was able to reproduce this bug on both Linux and Mac but haven't tried Windows.
Additional Note: I noticed that this issue occurs when the editor is bounded by a div that is smaller than the height of the contents of the editor. So as long as we have something like:

// bounded editor (constraint on the height of the viewport of the editor)
<div className='w-full h-[calc(100vh-40px)] overflow-hidden'>
    <PLATE EDITOR HERE/>
</div>

// unbounded editor (no constraint on height of the viewport of editor)
<div className='w-full h-full overflow-hidden'>
    <PLATE EDITOR HERE/>
</div>

Reproduction URL

https://platejs.org/editors

Reproduction steps

1. Go to https://platejs.org/editors
3. Scroll down to 'A Notion-like AI template'
4. Then scroll down to the block quote at the bottom of that editor.
5. In the middle of the sentence, hit enter once, then move the cursor back up to the point where you hit enter before and hit enter again.
6. You should see the editor scroll to the top 25% of the document leaving the content you were editing off the screen.

**Note**: simply hitting enter twice does not reproduce the issue. You have to go to the middle of a sentence, call this Point A, then hit enter. Then go back up to Point A and hit enter again.

Plate version

46.0.0 to current

Slate React version

0.112.0+

Screenshots

Logs

Browsers

Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions