Files
sousa-gecko/testing/web-platform/tests/css/css-scroll-snap/scroll-target-align-004.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

23 lines
912 B
HTML

<!DOCTYPE html>
<html>
<title>#target fragment navigation without scroll-snap-align (y-axis)</title>
<link rel='help' href='https://www.w3.org/TR/css-scroll-snap-1/#choosing'>
<link rel='match' href='scroll-target-004-ref.html'>
<meta name="flags" content="may">
<meta name='assert'
content="Test passes if the target element is aligned to the start
of the scroll container when navigating to its fragment ID,
with no scroll-snap-align set on the target.">
<style type='text/css'>
iframe {
border: solid blue 4px;
height: 80px;
width: calc(100% - 8px);
}
</style>
<div id='instructions'>Test passes if there is a green stripe across the first quarter of the box below and no red.</div>
<iframe class="container" src="support/scroll-target-align-004-iframe.html#target">This UA doesn't support iframes; please request a custom version of this test!</iframe>