Skip to content

Commit 6aa3150

Browse files
committed
Add SnapEvent Definition
Patchset 5: Per-axis SnapEvent targets, link 'proximity', improve text clarity
1 parent 9772813 commit 6aa3150

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

css-scroll-snap-2/Overview.bs

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ Snap Events {#snap-events}
318318
</li>
319319
</ul>
320320
</li>
321-
<li> (for snap containers with proximity strictness) at the end of a scroll in which
322-
the snap container scrolls and settles into (or out of) the
323-
proximity range of a snap area in either axis.
321+
<li> (for snap containers with ''scroll-snap-type/proximity'' strictness) at the end of a scroll in which
322+
the snap container scrolls and settles into (or out of) a
323+
snap area's range of proximity snap positions in either axis.
324324
</li>
325325
<li> if there is a change to a snap container's style such that it goes from having a
326326
non-'none' value for scroll-snap-type to having a 'none' value or vice versa.
@@ -329,9 +329,13 @@ Snap Events {#snap-events}
329329
snapped to changes, regardless of whether there is a change in scroll position
330330
after the layout change.
331331
</li>
332+
</ol>
332333

333334
Although, snapping occurs when a snap container is first
334-
laid out, snapchanged should not be triggered by this initial layout snap.
335+
laid out, {{snapchanged}} should not be triggered by this initial layout snap.
336+
Scrolling operations always lead to {{scrollend}} events being fired. If a scrolling operation
337+
also results in a {{snapchanged}} event being fired, the {{snapchanged}} event should be fired
338+
before the {{scrollend}} event.
335339

336340
<h4 id="snapchanging"> snapchanging </h4>
337341
{{snapchanging}} is dispatched when the snap area to which a
@@ -346,7 +350,7 @@ Snap Events {#snap-events}
346350
the snap position that will eventually be snapped to after the scroll animation's
347351
target offset is reached.
348352
* In the latter case, the user agent should evaluate whether snapchanging should
349-
be triggered based on the snap position that would eventually be snapped to if
353+
be triggered based on the snap position that would be snapped to if
350354
the scroll is ended at the current scroll position (determined by the user's input).
351355

352356
Note that since snapchanging gives the web page hints about future snapping,
@@ -361,24 +365,31 @@ SnapEvent interface
361365
<pre class="idl">
362366
[Exposed=Window]
363367
interface SnapEvent : Event {
364-
readonly attribute NodeList snapTargets;
368+
readonly attribute Node snapTargetBlock;
369+
readonly attribute Node snapTargetInline;
365370
};
366371
</pre>
367372

368373
<dl>
369-
<div dfn-type=attribute class=attributes dfn-for="SnapEvent">
370-
: <dfn>snapTargets</dfn>
374+
<div dfn-type=attribute class=attributes dfn-for="SnapEvent">
375+
: <dfn>snapTargetBlock</dfn>
371376
::
372-
The list of elements that the snap container is snapped
373-
to at the snap position for the associated snap event. For
374-
snapchanged events, the snap position is the position already
375-
realized by the snap container after a scroll snap. For snapchanging
376-
events it is the snap position that the scroller will eventually
377-
snap to when the scrolling operation ends.
378-
379-
This list includes one element for the block axis and/or one element for the inline axis.
380-
(TODO: link spec on how the target is picked).
377+
The element that the snap container is snapped to in the block axis
378+
at the snap position for the associated snap event.
381379
</div>
380+
<div dfn-type=attribute class=attributes dfn-for="SnapEvent">
381+
: <dfn>snapTargetInline</dfn>
382+
::
383+
The element that the snap container is snapped to in the inline axis
384+
at the snap position for the associated snap event.
385+
</div>
386+
387+
(TODO: link spec on how snap containers pick snap targets).
388+
389+
For {{snapchanged}} events, the snap position is the position already
390+
realized by the snap container after a scroll snap. For {{snapchanging}}
391+
events it is the snap position that the scroller will eventually
392+
snap to when the scrolling operation ends.
382393

383394
</dl>
384395

0 commit comments

Comments
 (0)