Skip to content

Commit

Permalink
fix(LinkBubble): Limit hide on scroll to editor scroll container
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mejo- committed Mar 25, 2024
1 parent dc3f642 commit 9502110
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/LinkBubblePluginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) => {
Expand Down Expand Up @@ -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 })
}

}
Expand Down

0 comments on commit 9502110

Please sign in to comment.