Files
ladybird/Tests/LibWeb/Text/input/hit_testing/overflow-hidden-with-positioned-child-after-scroll.html
Aliaksandr Kalenik 219a0dfff8 Tests: Add hit-testing test for overflow:hidden with viewport scroll
Add a test case that was reduced from a regression discovered and fixed
during the AccumulatedVisualContext refactoring. The test verifies that
hit-testing works correctly when an absolutely positioned element is
inside an overflow:hidden container and the viewport has been scrolled.
2026-01-15 19:50:53 +01:00

38 lines
812 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<style>
body {
margin: 0;
}
.spacer {
height: 1000px;
}
.container {
position: relative;
overflow: hidden;
width: 200px;
height: 100px;
}
#target {
position: absolute;
top: 10px;
left: 10px;
width: 50px;
height: 50px;
background: black;
}
</style>
<div class="spacer"></div>
<div class="container">
<div id="target"></div>
</div>
<script>
window.scrollTo(0, 1000);
test(() => {
const target = document.getElementById("target");
const rect = target.getBoundingClientRect();
const hitNode = internals.hitTest(rect.x + 10, rect.y + 10).node;
println(hitNode === target);
});
</script>