Files
ladybird/Tests/LibWeb/Text/input/hit_testing/visibility-visible-inside-hidden.html
Andreas Kling c550301a04 LibWeb: Allow hit testing visible children of hidden elements
Previously, hit testing would return early for elements with
visibility: hidden, which prevented their visible children from being
hit. Now we traverse children even for hidden elements, allowing visible
descendants to be hit while still preventing the hidden elements
themselves from being hit.

The key changes:
- PaintableBox::hit_test() and PaintableWithLines::hit_test() no longer
  return early for hidden elements, but still skip chrome hit testing
  and the final hit result for them
- hit_test_fragments() now checks is_visible() on each fragment's
  paintable to skip hidden text

This matches the CSS specification where visibility is inherited but
children can override it with visibility: visible.
2026-01-25 10:55:30 +01:00

22 lines
604 B
HTML

<!doctype html>
<body style="margin: 0">
<style>
#hidden-parent { visibility: hidden; font-size: 100px; }
#visible-child { visibility: visible; }
</style>
<div id="hidden-parent"><div id="visible-child">LOL</div></div>
<script src="../include.js"></script>
<script>
test(() => {
// Hit test in the middle of the visible text inside hidden parent
const result = internals.hitTest(50, 50);
if (result && result.node) {
printElement(result.node);
printElement(result.node.parentNode);
} else {
println("FAIL: no hit test result");
}
});
</script>
</body>