From 95021107b4964ecd7efc9c0f640ac26e1ac16a3e Mon Sep 17 00:00:00 2001 From: Jonas Date: Mon, 25 Mar 2024 10:38:56 +0100 Subject: [PATCH] fix(LinkBubble): Limit hide on scroll to editor scroll container * Add the scroll event listener to the app details pane, not to document * Don't dispatch the scroll event in capture phase Fixes: #5497 Signed-off-by: Jonas --- src/plugins/LinkBubblePluginView.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/LinkBubblePluginView.js b/src/plugins/LinkBubblePluginView.js index a0b34a9596f..ffa6a280451 100644 --- a/src/plugins/LinkBubblePluginView.js +++ b/src/plugins/LinkBubblePluginView.js @@ -11,6 +11,7 @@ class LinkBubblePluginView { this.options = options this.view = view this.plugin = plugin + this.scrollContainer = document.querySelector('.splitpanes__pane-details') this.#component = new VueRenderer(LinkBubbleView, { parent: this.options.parent, @@ -21,7 +22,7 @@ class LinkBubblePluginView { }) this.view.dom.addEventListener('dragstart', this.dragOrScrollHandler) - document.addEventListener('scroll', this.dragOrScrollHandler, { capture: true }) + this.scrollContainer.addEventListener('scroll', this.dragOrScrollHandler) } dragOrScrollHandler = (event) => { @@ -102,7 +103,7 @@ class LinkBubblePluginView { destroy() { this.tippy?.destroy() this.view.dom.removeEventListener('dragstart', this.dragOrScrollHandler) - document.removeEventListener('scroll', this.dragOrScrollHandler, { capture: true }) + this.scrollContainer.removeEventListener('scroll', this.dragOrScrollHandler, { capture: true }) } }