Files
ladybird/Tests/LibWeb/Ref/expected/scrollable-pseudo-element-ref.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

33 lines
541 B
HTML

<!DOCTYPE html>
<style>
/* Wrapper clips the scrollbar area */
.wrapper {
width: 85px;
height: 60px;
overflow: hidden;
}
.scrollable {
display: block;
white-space: pre-wrap;
width: 100px;
height: 60px;
overflow: scroll;
background: lightblue;
}
</style>
<div class="wrapper">
<div class="scrollable">Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8</div>
</div>
<script>
// Scroll to the same position as the test (40px)
document.querySelector('.scrollable').scrollTop = 40;
</script>