BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

fix: `scrollIntoView` issues

Open matthewlipski opened this issue 10 months ago • 4 comments

There are 2 issues relating to scrollIntoView that this PR fixes:

  1. When the user presses Enter to create a new block, and that block is below the viewport, it's not automatically scrolled to with scrollIntoView.
  2. When the user opens a suggestion menu, this is done simultaneously to scrollIntoView and results in incorrect positioning of the menu.

TODO: There is still an issue causing #656 to occur due to default browser behaviour scrolling automatically when an element is rendered outside the viewport. In theory, overflow-anchor: none should fix this when applied to the suggestion menus but I haven't had any luck with it. However, it shouldn't be an issue in the first place if the menu is rendered in the correct position, yet FloatingUI renders it in the old position first before quickly updating it.

matthewlipski avatar Apr 02 '24 20:04 matthewlipski

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview May 10, 2024 11:40am
blocknote-website ✅ Ready (Inspect) Visit Preview May 10, 2024 11:40am

vercel[bot] avatar Apr 02 '24 20:04 vercel[bot]

Possibly related: https://discord.com/channels/928190961455087667/1015169282444894219/1225268041667973243

YousefED avatar Apr 08 '24 10:04 YousefED

Possibly related: https://discord.com/channels/928190961455087667/1015169282444894219/1225268041667973243

How to solve this any solution? I am also facing the same.

shyamtawli avatar Apr 19 '24 12:04 shyamtawli

Possibly related - if you have a tall block with nested children, nesting a new child scrolls you to the top of the nested block, rather than keep the child you've just nested in view.

runonthespot avatar Apr 20 '24 08:04 runonthespot