From c5d0af54d0dea8e5019c4ac72e1a491160a2242d Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 1 Mar 2025 18:23:01 +0000 Subject: [PATCH] LibWeb: Don't handle scroll if no axes are accepted In some cases, we might be hovering directly on an element scrollable e.g. horizontally, but we are scrolling vertically. In these cases, we need to delegate the scroll to the parent instead of stalling the user's scroll. --- Libraries/LibWeb/Painting/PaintableBox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/Painting/PaintableBox.cpp b/Libraries/LibWeb/Painting/PaintableBox.cpp index d7ae415cc31..599f90c9945 100644 --- a/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -954,7 +954,8 @@ Paintable::DispatchEventOfSameName PaintableBox::handle_mousemove(Badge, CSSPixelPoint, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y) { - if (!could_be_scrolled_by_wheel_event()) { + // if none of the axes we scrolled with can be accepted by this element, don't handle scroll. + if ((!wheel_delta_x || !could_be_scrolled_by_wheel_event(ScrollDirection::Horizontal)) && (!wheel_delta_y || !could_be_scrolled_by_wheel_event(ScrollDirection::Vertical))) { return false; }