ladybird/Tests/LibWeb/Text/input/wheel-default-action-after-layout-update.html
Aliaksandr Kalenik 7bce509718 LibWeb: Recompute wheel default action target after layout updates
Wheel listeners can mutate layout before the wheel default action runs.
The old code kept using the paintable found before dispatch, so a
removed or moved scroller could still be treated as the default-action
target, and the viewport fallback used pre-dispatch layout state.

After dispatch, update layout and hit-test the wheel position again
before walking scrollable containing blocks. Fall back to viewport
scrolling only after that fresh target fails to consume the delta.
2026-05-14 19:41:32 +02:00

36 lines
690 B
HTML

<!DOCTYPE html>
<script src="include.js"></script>
<style>
body {
margin: 0;
}
#scroller {
width: 100px;
height: 100px;
overflow: scroll;
}
#spacer {
height: 500px;
}
#page-spacer {
height: 2000px;
}
</style>
<div id="scroller"><div id="spacer"></div></div>
<div id="page-spacer"></div>
<script>
test(() => {
scroller.addEventListener("wheel", () => {
scroller.remove();
document.body.offsetHeight;
}, { passive: false });
internals.wheel(50, 50, 0, 100);
println("PASS");
println(`window.scrollY: ${window.scrollY}`);
});
</script>