43084309326c29e121a731690b288d53e67f273f chmalee Fri Sep 8 14:50:50 2023 -0700 make mouseovers disappear on scrolling the document, refs #31365 diff --git src/hg/js/utils.js src/hg/js/utils.js index d5e0d2c..38454c2 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -3954,30 +3954,31 @@ }); positionMouseover(e, referenceElement, mouseoverContainer, e.pageX, e.pageY); mouseoverContainer.classList.add("isShown"); mouseoverContainer.style.opacity = "1"; mouseoverContainer.style.visibility = "visible"; // Events all get their own unique id but they are tough to keep track of if we // want to remove one. We can use the new AbortController interface to let the // web browser automatically raise a signal when the event is fired and remove // appropriate event mousemoveSignal = new AbortController(); let callback = mousemoveHelper.bind(mouseoverContainer); // allow the user to mouse over the mouse over, (eg. clicking a link or selecting text) document.addEventListener("mousemove", callback, {signal: mousemoveSignal.signal}); + document.addEventListener("scroll", callback, {signal: mousemoveSignal.signal}); mouseoverTimer = undefined; } function showMouseover(e) { /* Helper function for showing a mouseover. Uses a timeout function to allow * user to not immediately see all available tooltips. */ e.preventDefault(); // if a tooltip is currently visible, we need to wait for its mouseout // event to clear it before we can show this one, ie a user "hovers" // this element on their way to mousing over the shown mouseover if (mouseoverTimer) { // user is moving their mouse around, make sure where they stop is what we show clearTimeout(mouseoverTimer); } mouseoverTimer = setTimeout(showMouseoverText, 300, e);