RESOLVED DUPLICATE of bug 280085280084
Wheel event with preventDefault() and DOM updates not preventing page scroll
https://bugs.webkit.org/show_bug.cgi?id=280084
Summary Wheel event with preventDefault() and DOM updates not preventing page scroll
erjona.topalli
Reported 2024-09-20 14:01:27 PDT
Consider the scenario where an element is inside of a page that is scrollable. A wheel event handler is attached to the element, and event.preventDefault() is called inside the handler. When wheel gesture is initiated over the element, then the page should never scroll. We find that if the wheel event handler also performs sufficiently large number of DOM operations, then the page may scroll even if the event.preventDefault() is called. This is not observed on latest Chrome (v128) and Edge (v128). For context, we encountered this when we tried to build a SVG based visualization. When wheel gesture is initiated over the visualization, we want to prevent the page from scrolling and perform a zoom operation. During zoom we perform svg DOM operations to change the view to reflect the zoom. On Firefox, when the visualization is heavy enough, the page annoyingly jumps during the wheel zoom, which in some cases prevents the zoom from even happening. The desired behavior is the page never jumps, and the visualization just takes whatever time it needs to update during the wheel zoom, which is the behavior we observe on Chromium based browsers. Steps to reproduce: 1. Go to this codepen: https://codepen.io/wlouie1/pen/wvLVxaM 2. Scroll inside the gray component container Expected Result: The page should not scroll because of the wheel event.preventDefault() Actual Result: The page scrolls after a series of continuous wheel events within the gray component container, despite the preventDefault. Tested on Firefox 130.0 (Mac and Windows)
Attachments
erjona.topalli
Comment 1 2024-09-20 14:13:34 PDT
*** This bug has been marked as a duplicate of bug 280085 ***
Note You need to log in before you can comment on or make changes to this bug.