Skip to content

Commit 244c3cd

Browse files
committed
[css-scroll-snap-1] Make the 'scoping positions to visible boxes' requirement clearer. Fixes #2526.
1 parent 3f426e4 commit 244c3cd

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

css-scroll-snap-1/Overview.bs

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -591,28 +591,36 @@ Scoping Valid Snap Positions to Visible Boxes</h4>
591591

592592
Since the purpose of scroll snapping is to align content within the viewport
593593
for optimal viewing,
594-
a <a>scroll container</a> cannot be <a>snapped</a> to a <a>snap area</a>
595-
if no part of it is within the <a>snapport</a>.
596-
For example, a <a>snap area</a> is top-aligned to the <a>snapport</a>
597-
if its top edge is coincident with the <a>snapport</a>’s top edge;
598-
however, this scroll position is nonetheless not a valid <a>snap position</a>
599-
if the entire <a>snap area</a> is outside the <a>snapport</a>
600-
(because the required alignment, though satisfied, would not be relevant to the viewer).
601-
602-
<figure>
603-
<pre class="ascii-art">
604-
╔════viewport════╗┈┈┈┈┈┈┈┈┌──────────────┐
605-
║ ┌─────┐ ┌──┐ ║ │ top-snapping │
606-
║ ├──┐ │ └──┘ ║ │ element │
607-
║ └──┴──┘ ║ │ │
608-
╚════════════════╝ │ │
609-
└──────────────┘
610-
</pre>
611-
<figcaption>
612-
Alignment of an off-screen element
613-
is not considered <a>snapping</a>.
614-
</figcaption>
615-
</figure>
594+
a scroll position cannot be considered a valid <a>snap position</a>
595+
if <a>snapping</a> to it would leave the contributing <a>snap area</a>
596+
entirely outside the <a>snapport</a>,
597+
even if it otherwise satisfies the required alignment of the <a>snap area</a>.
598+
599+
<div class="example">
600+
For example, a <a>snap area</a> is top-aligned to the <a>snapport</a>
601+
if its top edge is coincident with the <a>snapport</a>’s top edge;
602+
and this would be considered a valid <a>snap position</a>
603+
for block-axis start-aligned snapping of that <a>snap area</a>
604+
<em>if at least part of the <a>snap area</a> is on-screen</em>.
605+
If the entire <a>snap area</a> is outside the <a>snapport</a>, however,
606+
then the <a>scroll container</a> cannot be considered to be <a>snapped</a>
607+
because the required alignment, though satisfied, would not be relevant to the viewer.
608+
609+
<figure>
610+
<pre class="ascii-art">
611+
╔════viewport════╗┈┈┈┈┈┈┈┈┌──────────────┐
612+
║ ┌─────┐ ┌──┐ ║ │ top-snapping │
613+
║ ├──┐ │ └──┘ ║ │ element │
614+
║ └──┴──┘ ║ │ │
615+
╚════════════════╝ │ │
616+
└──────────────┘
617+
</pre>
618+
<figcaption>
619+
Alignment of an off-screen element
620+
is not considered <a>snapping</a>.
621+
</figcaption>
622+
</figure>
623+
</div>
616624

617625
<details class="note">
618626
<summary>Why limit snapping to only when the element is visible?</summary>

0 commit comments

Comments
 (0)