Files
sousa-gecko/testing/web-platform/tests/css/cssom-view/scrollIntoView-scrolling-box-with-large-border.html
T
Martin RobinsonandOriol Brufau 3940e674a4 Bug 1989987 [wpt PR 54976] - script: Remove absolute positioning workaround from scrollIntoView implementation, a=testonly
Automatic update from web-platform-tests
script: Remove absolute positioning workaround from `scrollIntoView` implementation

This isn't needed as the border box query already takes into account the
containing block chain. Instead, consistently calculate the new
scroll position for a scroller relative to its current scroll offset.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>

--

wpt-commits: 34ef18cf3d29cf07f28411b93e746aa2a1e52384
wpt-pr: 54976
2025-09-26 12:08:15 +00:00

23 lines
965 B
HTML

<!DOCTYPE html>
<title>CSSOM View - scrollIntoView should account for the border of scrollable elements.</title>
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview">
<link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com">
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="scroller" style="overflow: scroll; border: solid 100px; width: 100px; height: 100px;">
<div style="height: 1000px;"></div>
<div id="target" style="background: green; width: 100px; height: 100px"></div>
<div style="height: 1000px;"></div>
</div>
<script>
test(function() {
target.scrollIntoView();
assert_equals(1000, scroller.scrollTop, "Should scroll the target into view.");
}, "scrollIntoView takes into account the border of the scroller");
</script>