From bfea362a11212abaccdab76a7e3d649eadd8a5de Mon Sep 17 00:00:00 2001 From: Kasper Munch Date: Sat, 4 Oct 2025 09:41:40 +0200 Subject: [PATCH] Fix page scrolling when using mouse wheel to zoom in Jupyter notebooks Adds a wheel event listener that prevents event propagation to the parent page while still allowing HiGlass to handle zoom interactions. This fixes the issue where scrolling to zoom in the HiGlass widget would also scroll the Jupyter notebook page, particularly when running notebooks in VS Code. The fix uses stopPropagation() with passive: false to intercept wheel events at the widget container level before they bubble up to the notebook. --- src/higlass/widget.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/higlass/widget.js b/src/higlass/widget.js index 30b3bb3..85364d2 100644 --- a/src/higlass/widget.js +++ b/src/higlass/widget.js @@ -273,6 +273,12 @@ function addEventListenersTo(el) { signal: controller.signal, }); + // prevent wheel events from scrolling the page while allowing HiGlass zoom + el.addEventListener("wheel", (event) => event.stopPropagation(), { + signal: controller.signal, + passive: false, + }); + return () => controller.abort(); }