Files
ladybird/Tests/LibWeb/Ref/input/scrollable-pseudo-element.html
Aliaksandr Kalenik 0fcd8c0bfa LibWeb: Fix pseudo-element scroll offset leaking to generating element
In Element::set_scroll_offset(), when setting a pseudo-element's
scroll offset, the code was also incorrectly setting the generating
element's own m_scroll_offset. Added an else branch so only the
pseudo-element's offset is set.

Also adds a ref test for scrollable pseudo-elements to prevent
regression. The test scrolls a ::before pseudo-element via wheel
event and verifies the content scrolls correctly.
2026-01-27 20:32:12 +01:00

28 lines
642 B
HTML

<!DOCTYPE html>
<link rel="match" href="../expected/scrollable-pseudo-element-ref.html" />
<style>
/* Wrapper clips the scrollbar area */
.wrapper {
width: 85px;
height: 60px;
overflow: hidden;
}
.container::before {
display: block;
content: "Line 1\A Line 2\A Line 3\A Line 4\A Line 5\A Line 6\A Line 7\A Line 8";
white-space: pre-wrap;
width: 100px;
height: 60px;
overflow: scroll;
background: lightblue;
}
</style>
<div class="wrapper">
<div class="container"></div>
</div>
<script>
// Scroll the pseudo-element by 40px (approximately 2 lines)
internals.wheel(50, 30, 0, 40);
</script>