BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

Cannot fully scroll in slash menu near end of page

Open Wqrld opened this issue 6 months ago • 7 comments

What’s broken?

When the new block menu is open, one is not able to scroll to the end.

img

Also reproducible on https://www.blocknotejs.org/examples/basic/minimal

What did you expect to happen?

i should be able to see the full menu

Steps to reproduce

write some text in a document. Then when in the bottom quadrant of the page, click the plus symbol or type a slash to open the block selection menu.

Attempt to scroll to the bottom. You are not able to.

Reproduced to happen on both firefox linux and chrome windows on different screen sizes.

BlockNote version

latest as of may 23th

Environment

Chrome, Firefox, Blocknote demo site

Additional context

No response

Contribution

  • [ ] I'd be interested in contributing a fix for this issue

Sponsor

  • [ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Wqrld avatar May 23 '26 20:05 Wqrld

I don't see this issue on this page on either firefox or chrome: https://www.blocknotejs.org/examples/basic/minimal

https://github.com/user-attachments/assets/d665855e-392d-49eb-82af-2e510f85c4ae

nperez0111 avatar May 24 '26 08:05 nperez0111

I don't see this issue on this page on either firefox or chrome: https://www.blocknotejs.org/examples/basic/minimal Screen.Recording.2026-05-24.at.10.03.27.mov

Hi, it indeed only happens when the slash menu is opened in the bottom quadrant of the editing box. Hold enter for a bit until close to the end of the box, and then try again.

Wqrld avatar May 24 '26 08:05 Wqrld

Cool, I do see the issue now. Thanks for reporting

nperez0111 avatar May 24 '26 08:05 nperez0111

diff --git a/packages/core/src/extensions/SuggestionMenu/SuggestionMenu.ts b/packages/core/src/extensions/SuggestionMenu/SuggestionMenu.ts
index 4809607e6..c781ae9fe 100644
--- a/packages/core/src/extensions/SuggestionMenu/SuggestionMenu.ts
+++ b/packages/core/src/extensions/SuggestionMenu/SuggestionMenu.ts
@@ -49,7 +49,7 @@ class SuggestionMenuView {
     this.rootEl?.addEventListener("scroll", this.handleScroll, true);
   }
 
-  handleScroll = () => {
+  handleScroll = (event: Event) => {
     if (this.state?.show) {
       const decorationNode = this.rootEl?.querySelector(
         `[data-decoration-id="${this.pluginState!.decorationId}"]`,
@@ -57,6 +57,16 @@ class SuggestionMenuView {
       if (!decorationNode) {
         return;
       }
+      // `capture=true` makes this fire for every scroll in the editor subtree,
+      // including the suggestion menu's own `overflow-y: auto` scroll. Only the
+      // scroll of an ancestor that actually contains the cursor decoration can
+      // move its on-screen position, so we ignore scrolls from elements that
+      // don't contain it. Otherwise scrolling inside the menu would recompute
+      // `referencePos` and reposition the menu, causing it to jitter (#2771).
+      const scrollTarget = event.target as Node | null;
+      if (scrollTarget && !scrollTarget.contains(decorationNode)) {
+        return;
+      }
       this.state.referencePos = decorationNode
         .getBoundingClientRect()
         .toJSON() as DOMRect;

Working git patch that resolves the issue. Not PRring yet as i don´t fully get why this happens.

Interestingly, it also seems vaguely dependent on your screen size. I cannot easily reproduce on my higher-quality bigger screen.

Wqrld avatar Jun 02 '26 12:06 Wqrld

+1 @Wqrld thank you for the patch!

venarius avatar Jul 01 '26 17:07 venarius

Also experiencing this issue. Any update on this? Attached a video from the documentation pages displaying the issue. Its still a problem on the latest version of blocknote, and happens both on keyboard navigation and scroll.

https://github.com/user-attachments/assets/0345cbd8-c58e-4345-bfca-616e27a65137

skjalghodneland avatar Sep 07 '26 08:09 skjalghodneland

I’ve encountered the same problem too.

CupOfBread avatar Sep 14 '26 12:09 CupOfBread