Skip to content

Commit 6964742

Browse files
committed
Resolve issue 4 by defining how nested large snap areas work.
1 parent a2be3b3 commit 6964742

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

css-scroll-snap/Overview.bs

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ Scoping Valid Snap Positions to Visible Boxes</h4>
514514
if the entire <a>snap area</a> is outside the <a>snapport</a>.
515515

516516
<figure>
517-
<pre>
517+
<pre class="ascii-art">
518518
╔════viewport════╗┈┈┈┈┈┈┈┈┌──────────────┐
519519
║ ┌─────┐ ┌──┐ ║ │ top-snapping │
520520
║ ├──┐ │ └──┘ ║ │ element │
@@ -546,7 +546,9 @@ Scoping Valid Snap Positions to Visible Boxes</h4>
546546
Snapping Boxes that Overflow the Scrollport</h4>
547547

548548
If the <a>snap area</a> is larger than the <a>snapport</a> in a particular axis,
549-
then any scroll position in which the <a>snap area</a> covers the <a>snapport</a>
549+
then any scroll position in which the <a>snap area</a> covers the <a>snapport</a>,
550+
and the distance between the geometrically previous and subsequent <a>snap positions</a> in that axis
551+
is larger than size of the <a>snapport</a> in that axis,
550552
is a valid <a>snap position</a> in that axis.
551553
The UA may use the specified alignment as a more precise target
552554
for certain scroll operations (e.g. explicit paging).
@@ -567,7 +569,63 @@ Snapping Boxes that Overflow the Scrollport</h4>
567569
until it is scrolled sufficiently to trigger snapping to a different <a>snap position</a>.
568570
</div>
569571

570-
Issue: Deal with case of overlapping snap areas, some of which are smaller and others larger than the viewport.
572+
<div class=example>
573+
For another example,
574+
mandatory top-snapping on nested <{section}> elements
575+
can produce large snapping areas
576+
(from large top-level sections)
577+
potentially filled with smaller snapping areas
578+
(from the subsections).
579+
When the subsections are small enough,
580+
they snap normally;
581+
when they're longer,
582+
the viewer can scroll arbitrarily within them,
583+
or within a large segment of the top-level section that has no subsections to snap to.
584+
585+
<figure>
586+
<pre class=ascii-art>
587+
┌─ top-level section ─┐ ━┓
588+
│ │ 1┃
589+
│ │ ┃
590+
│ │ ━┩
591+
│ │ ┆
592+
│ │ ┆
593+
│┌─── sub-section ───┐│ ╯ ━┓
594+
│└───────────────────┘│ 2┃
595+
│┌─── sub-section ───┐│ ┃ ━┓
596+
││ ││ ━┛ 3┃
597+
│└───────────────────┘│ ┃
598+
│┌─── sub-section ───┐│ ━┓ ━┛
599+
│└───────────────────┘│ 4┃
600+
│┌─── sub-section ───┐│ ┃ ━┓
601+
││ ││ ━┛ 5┃
602+
││ ││ ┃
603+
││ ││ ━┩
604+
││ ││ ┆
605+
││ ││ ┆
606+
││ ││ ┆
607+
│└───────────────────┘│ ┆
608+
└─────────────────────┘ ╯
609+
</pre>
610+
<figcaption>
611+
In the figure above,
612+
the five numbered viewports
613+
represent the five snap positions
614+
associated with the top-level section
615+
and its four subsections.
616+
Because the first and last snap positions are part of ranges taller than the viewport,
617+
the viewer is allowed to scroll freely
618+
between the top and bottom of each range.
619+
</figcaption>
620+
</figure>
621+
622+
Note: If the author had instead set mandatory snap positions on the headings of each section
623+
(rather than the sections themselves),
624+
the contents of the first and fifth sections
625+
would be partially inaccessible to the user,
626+
as the heading snap area does not extend to cover the whole section.
627+
</div>
628+
571629

572630
<h4 id="unreachable">
573631
Unreachable Snap Positions</h4>

default.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
pre.ascii-art {
4040
display: table; /* shrinkwrap */
4141
margin: 1em auto;
42+
line-height: normal;
4243
}
4344

4445
/* Displaying the output of text layout, particularly when

0 commit comments

Comments
 (0)