diff --git a/Tests/LibWeb/Text/expected/wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.txt b/Tests/LibWeb/Text/expected/wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.txt new file mode 100644 index 00000000000..0f9ff1f8450 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.txt @@ -0,0 +1,2 @@ + scrollable.scrollTop: 100 +window.scrollY: 0 diff --git a/Tests/LibWeb/Text/input/wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.html b/Tests/LibWeb/Text/input/wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.html new file mode 100644 index 00000000000..9d4a3e80b1d --- /dev/null +++ b/Tests/LibWeb/Text/input/wheel-events-consumed-by-scrollable-should-not-be-propagated-to-body.html @@ -0,0 +1,32 @@ + + + + +
+ diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 87bba02d696..bb096e1c724 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -174,10 +174,9 @@ bool EventHandler::handle_mousewheel(CSSPixelPoint position, CSSPixelPoint scree if (paintable) { auto* containing_block = paintable->containing_block(); while (containing_block) { - if (containing_block->is_user_scrollable()) { - const_cast(containing_block->paintable_box())->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x, wheel_delta_y); - break; - } + auto handled_scroll_event = const_cast(containing_block->paintable_box())->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x, wheel_delta_y); + if (handled_scroll_event) + return true; containing_block = containing_block->containing_block(); }