You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Current spec doesn't define how to select which snap-point to snap to.
506
-
See <a href="https://lists.w3.org/Archives/Public/www-style/2015Jul/0325.html">https://lists.w3.org/Archives/Public/www-style/2015Jul/0325.html</a>
507
-
for a proposal to ignore snap positions far outside the viewport.
508
-
509
-
Issue: UAs should be encouraged to ignore snap positions that require scrolling in two dimensions
510
-
when a one-dimensional scroll is triggered.
511
-
512
-
Issue: Define that <a>snap position</a> selection is based on the final scroll position that the scroll physics would land the scroller in after a fling.
513
-
514
-
<!--
515
-
Scoping Snaplines to Visible Objects: the 'scroll-snap-scope' property {#scroll-snap-scope}
516
-
---------------------------
517
-
518
-
<pre class="propdef">
519
-
Name: scroll-snap-scope
520
-
Value: infinite | finite
521
-
Initial: infinite
522
-
Applies to: all elements
523
-
Inherited: no
524
-
Computed value: as specified
525
-
Animatable: no
526
-
Media: interactive
527
-
</pre>
528
-
529
-
When ''finite'' snapping is enabled,
530
-
the "gravitational field" of a snap alignment is two-dimensional:
531
-
distance to the snap position is calculated for both dimensions at once.
532
-
533
-
In other words, if the snapping radius of influence is <var>r</var>,
534
-
in infinite snapping the box snaps along the y axis
535
-
whenever it is within <var>r</var> of its snapped y position,
536
-
regardless of its x position.
537
-
But in finite snapping,
538
-
the box snaps along the y axis
539
-
whenever it is within <var>r</var> of its snapped position
540
-
in both dimensions.
541
-
542
-
<div class="example">
543
-
For example, a small box is snapped to the center of the viewport.
544
-
It only snaps whenever it is < <var>r</var> distance in any direction
545
-
from its snap position in both dimensions.
546
-
In other words, it snaps whenever sqrt(<var>d<sub>x</sub></var><sup>2</sup> + <var>d<sub>y</sub></var><sup>2</sup>) ≤ <var>r</var>
547
-
for <var>d<sub>x</sub></var>,<var>d<sub>y</sub></var> as distance to the snapped position in the x and y dimensions, respectively.
548
-
</div>
549
-
550
-
<div class="example">
551
-
As another example, a small box is snapped to the edges of the viewport.
552
-
It only snaps whenever matching edges are within <var>r</var> of the respective viewport edges,
553
-
so e.g. whenever its top edge approaches the top of the viewport,
554
-
or its left edge approaches the left of the viewport;
555
-
but there is no snapping effect if those edges are > <var>r</var> outside the viewport.
556
-
</div>
498
+
Snapping Mechanics {#snap}
499
+
==========================
500
+
501
+
The precise model algorithm to select a <a>snap position</a> to snap to
502
+
is intentionally left mostly undefined,
503
+
so that user agents can take into account sophisticated models of user intention and interaction
504
+
and adjust how they respond over time,
505
+
to best serve the user.
506
+
507
+
This section defines some useful concepts to aid in discussing scroll-snapping mechanics,
508
+
and provides some guidelines for what an effective scroll-snapping strategy might look like.
509
+
User agents are encouraged to adapt this guidance
510
+
and apply their own best judgement
511
+
when defining their own snapping behavior.
512
+
It also provides a small number of behavior requirements,
513
+
to ensure a minimum reasonable behavior that authors can depend on
514
+
when designing their interfaces with scroll-snapping in mind.
515
+
516
+
Types of Scrolling Gestures {#scroll-types}
517
+
-------------------------------------------
518
+
519
+
There are at least three distinct form of scroll gestures that a user might perform on a page,
520
+
which can reasonably trigger different snapping behaviors:
:: A scroll is <a>semantic</a> if it expresses a preferred direction to scroll in,
545
+
but not a specific amount of scrolling,
546
+
or a specific "momentum" to a fling.
547
+
This is most commonly from pressing an arrow key;
548
+
for example, pressing the Down key indicates that you want to scroll down some amount.
549
+
550
+
Additionally, because page layouts usually align things vertically and/or horizontally,
551
+
UAs sometimes <dfn export>axis-lock</dfn> a scroll when the gesture triggering it
552
+
is sufficiently vertical or horizontal.
553
+
An <a>axis-locked</a> scroll is usually bound to only scroll along that axis;
554
+
this prevents,
555
+
for example,
556
+
a <em>nearly</em> horizontal fling gesture from gradually drifting up or down as well,
557
+
because it is very difficult to fling in a precisely horizontal line.
558
+
559
+
Types of Snap Points {#snap-types}
560
+
----------------------------------
561
+
562
+
There are two distinct forms of <dfn export lt="scroll snap point" local-lt="snap point">snap points</dfn> that a <a>scroll container</a> might contain:
0 commit comments