Files
sousa-gecko/testing/web-platform/tests/css/css-scroll-snap/support/scroll-target-align-004-iframe.html
T
Hiroyuki Ikezoe e08601065e Bug 2037631 - Respect scroll-snap-align when scrolling to a fragment. r=layout-reviewers,webidl,emilio
Add "auto" to ScrollLogicalPosition per https://github.com/w3c/csswg-drafts/issues/9576.
Fragment navigation now passes WhereToScroll::Auto so that scroll-snap-align is
respected when present, falling back to the spec defaults (start for block,
nearest for inline) when absent. Explicit scrollIntoView() alignment values are
no longer overridden by snap alignment.

GetScrollSnapAlignFor previously returned None for all axes when the scroll
container had scroll-snap-type: none. Remove that early return so that fragment
navigation (which uses WhereToScroll::Auto) can still honor the target's
scroll-snap-align even on non-snapping containers, as the spec permits.

Differential Revision: https://phabricator.services.mozilla.com/D298959
2026-05-07 03:23:07 +00:00

38 lines
860 B
HTML

<!DOCTYPE html>
<title>iframe for #target fragment navigation without scroll-snap-align</title>
<style type='text/css'>
html, body {
margin: 0; padding: 0;
}
html {
/* to make failing more obvious */
background: 0 0 1em linear-gradient(red, red) repeat-x fixed;
/* avoid anti-aliasing issues */
font: 20px/1 sans-serif;
scrollbar-width: none;
}
div {
height: 1em;
}
#target { background: green; }
.fail { color: red; } /* make failing more obvious */
/* emulate `scrollbar-width: none` for browsers that don't support it yet */
::-webkit-scrollbar { display: none; }
</style>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="fail">FAIL</div>
<div id="target"></div>
<div></div>
<div></div>
<div></div>
<div class="fail">FAIL</div>
<div></div>
<div></div>
<div></div>
<div></div>