Skip to content

Commit 8b86cc6

Browse files
committed
[css-scroll-snap] Clarify that off-screen snap areas can't create a valid snap position, even if they align as specified by scroll-snap-align.
1 parent c7935a0 commit 8b86cc6

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

css-scroll-snap/Overview.bs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,28 @@ Scroll Snapping Alignment: the 'scroll-snap-align' property {#scroll-snap-align}
529529
the position applies to both axises.
530530
</dl>
531531

532+
Since the purpose of scroll snapping is to align content within the viewport
533+
for optimal viewing:
534+
in all cases, the specified alignment creates a valid <a>snap position</a>
535+
only if at least part of the <a>snap area</a> is within the <a>snap viewport</a>.
536+
For example, a <a>snap area</a> is top-aligned to the <a>snap viewport</a>
537+
if its top edge is coincident with the <a>snap viewport</a>’s top edge;
538+
however, this alignment is nonetheless not a valid <a>snap position</a>
539+
if the entire <a>snap area</a> is outside the <a>snap viewport</a>.
540+
541+
<details class="why">
542+
<summary>Why</summary>
543+
As the <a href="https://www.webkit.org/blog/4017/scroll-snapping-with-css-snap-points/">WebKit implementers point out</a>,
544+
extending a snap edge infinitely across the canvas
545+
only allows for snapping gridded layouts,
546+
and produces odd behavior for the user
547+
when off-screen elements do not align
548+
with on-screen elements.
549+
(If this requirement is onerous for implementers however,
550+
we can default to a gridded behavior
551+
and introduce a switch to get smarter behavior.)
552+
</details>
553+
532554
For all of these values,
533555
the <a>block</a> or <a>inline</a> axis
534556
is relative to the element's parent's <a>writing mode</a>.

0 commit comments

Comments
 (0)