Skip to content

Commit c0def59

Browse files
authored
Fix page scrolling when using mouse wheel to zoom in Jupyter notebooks (#194)
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.
1 parent ca5fb56 commit c0def59

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/higlass/widget.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ function addEventListenersTo(el) {
273273
signal: controller.signal,
274274
});
275275

276+
// prevent wheel events from scrolling the page while allowing HiGlass zoom
277+
el.addEventListener("wheel", (event) => event.stopPropagation(), {
278+
signal: controller.signal,
279+
passive: false,
280+
});
281+
276282
return () => controller.abort();
277283
}
278284

0 commit comments

Comments
 (0)