ladybird/Tests/LibWeb/Text/input/hit_testing/empty-anonymous-container-overlapping.html
Jelle Raaijmakers 2cc8f0821c LibWeb: Don't hit test anonymous containers if there are no fragments
We were always delegating hit tests to PaintableBox if a
PaintableWithLines has no fragments, which means that anonymous
containers could overlap with previous siblings and prioritize their
border box rect. Instead, the nearest non-anonymous ancestor should take
care of hit testing the children so the correct order is maintained.

To achieve this, we no longer do an early hit test in
PaintableWithLines::hit_test() if there are no fragments and default
to the later PaintableBox::hit_test() call that does take anonymous
containers into account.

Fixes the issue seen in #4864.
2025-07-05 23:56:42 +01:00

19 lines
417 B
HTML

<!DOCTYPE html>
<style>
#a {
margin-bottom: -20px;
}
body {
border: 1px solid blue;
}
</style>
<script src="../include.js"></script>
<div id="a"><a href="#" id="target">You should be able to click this link</a></div><br>
<script>
test(() => {
const hit = internals.hitTest(50, 18);
printElement(hit.node);
println(`index: ${hit.indexInNode}`);
printElement(hit.node.parentNode);
});
</script>