Files
ladybird/Tests/LibWeb/Text/input/input-scrolled-hit-test.html
Jelle Raaijmakers 2558d80288 LibWeb: Apply AVC for descendants when hit testing fragments
We were not applying the descendants' transformation when hit testing on
fragments, which meant selection offsets on scrolled containers were
off.
2026-02-11 11:04:53 +01:00

29 lines
777 B
HTML

<!DOCTYPE html>
<style>
input {
font-size: 16px;
width: 100px;
padding: 2px;
border: 1px solid;
}
</style>
<input value="foobarbazloremipsum foobarbazloremipsum" />
<script src="include.js"></script>
<script>
test(() => {
const input = document.querySelector("input");
input.offsetWidth;
input.focus();
// Scroll the inner text element to the right.
const innerText = internals.getShadowRoot(input).querySelector("div > div");
innerText.scrollLeft = 100;
// Click near the left edge of the input.
const rect = input.getBoundingClientRect();
internals.click(rect.left + 5, rect.top + rect.height / 2);
println(input.selectionStart);
});
</script>