Re: [csswg-drafts] CSS Snap Points: Event Model Missing (#156)

> Other questions:
> 
>     * Is your event supposed to be fired when the browser has landed on the snapped position and stopped moving, or as soon as it has decided on a snap position, even though it might still be moving towards it? (I think it's the former, but it's good to be clear)

When the browser has landed on the snapped position and stopped moving. The "decided on a snap position" case is probably meant by the `snapstart` event mentioned by @scottjehl.

>     * If the user starts scrolling away from a snap point, but not very far, releases, and the browser snaps back to the same one, do we fire a new event because we resnapped, or not, because we effectively didn't leave the snappoint?

A new event should be fired. The author can distinguish this re-snapping by checking `event.target === event.relatedTarget` if necessary.

>     * Same question as above, but with the user resizing the window rather than scrolling.

I tend to say yes for that case, because the snap position can change in that case. Not necessarily when the scroll container was already snapped before the change and is snapped to the same position after the resizing, as the spec. requires to re-snap at that position in that case. Though for consistency the event might also be triggered in that case.

>     * Same question as above, but with the "resnapping" being triggered by a change in content / styling

Same as above.

>     * If the snap position is continuously moving due to an animation or a transition, and the browser continuously tracking it, do we send a stream a events because we're continuously resnapping, or not because we never leave the snapped state?

As far as I can see, the specification currently doesn't define what happens for animations and transitions, i.e. whether snap positions are continuously adjusted or just when the animation or transition ends.

If the snapped state is never left and the scroll container stays snapped at the same snap position, I'd say no event should be fired.

Generally speaking, everytime the snapped state changes from "not snapped" to "snapped" a new `snapped` event should be fired.

Sebastian

-- 
GitHub Notification of comment by SebastianZ
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/156#issuecomment-695836809 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 20 September 2020 21:10:25 UTC