Skip to content

Commit ac71c01

Browse files
committed
[css-scroll-snap-1] Add bottom-snapped console example from http://tabatkins.github.io/specs/css-sticky-scrollbars/#intro #4371
1 parent ce08997 commit ac71c01

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

css-scroll-snap-1/Overview.bs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ Scroll Snap Strictness: the ''scroll-snap-type/none'', ''proximity'', and ''mand
396396
Otherwise, the box has no <a>scroll snap container</a>,
397397
and its <a>snap positions</a> do not trigger <a>snapping</a>.
398398

399+
<h4 id="re-snap">
400+
Re-snapping After Layout Changes</h4>
401+
399402
If the content or layout of the document changes
400403
(e.g. content is added, moved, deleted, resized)
401404
such that the content of a <a>snapport</a> changes,
@@ -407,6 +410,39 @@ Scroll Snap Strictness: the ''scroll-snap-type/none'', ''proximity'', and ''mand
407410
the scroll container must be re-snapped to that same snap position
408411
after the content change.
409412

413+
<div class="example">
414+
In the following example,
415+
the log console,
416+
when initially loaded and as each message is added to the bottom,
417+
remains snapped to the bottom of the content
418+
unless the user has scrolled away from that edge:
419+
420+
<pre class="lang-css">
421+
.log {
422+
scroll-snap-type: proximity;
423+
align-content: end;
424+
}
425+
.log::after {
426+
display: block;
427+
content: "";
428+
scroll-snap-align: end;
429+
}
430+
</pre>
431+
432+
The rules create a single [=scroll snap area=]
433+
represented by the ''::after'' pseudo-element,
434+
positioned at the very bottom of a [=scroll snap container=].
435+
If the user scrolls “near” the bottom,
436+
the container will snap to it.
437+
If more content is dynamically added to the container,
438+
it’ll remain snapped to it
439+
(because scroll containers are required
440+
to re-snap to the same scroll snap area
441+
if it still exists after any changes).
442+
However, if the user has scrolled to somewhere else in the logs,
443+
it won’t do anything at all.
444+
</div>
445+
410446
<!--
411447
████████ ███ ████████ ████████ ████ ██ ██ ██████
412448
██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██

0 commit comments

Comments
 (0)