[css-scroll-snap-1] Specify that re-snapping is deferred until an active scrolling gesture ends
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
Summary
The re-snapping section defines when a snapped scroll container must re-evaluate and update its snap position after layout or content changes, but it does not say what should happen if such a change occurs while the user is in the middle of an active scrolling gesture.
We propose the spec explicitly state that re-snapping is deferred until the active scrolling gesture has ended, rather than being applied mid-gesture.
Motivation
When a layout change triggers re-snapping while the user is still actively scrolling, the scroll position is yanked to a snap point underneath the user's moving finger(s). This produces visible jitter and can make it impossible to scroll past the snap point, because every layout change re-snaps the container back. The expected, intuitive behavior is that the scroll position follows the user's input continuously and only snaps once the gesture is released.
Interop
This is already the behavior of Chrome (Android) and Safari (iOS): both defer re-snapping until the scrolling gesture completes. Codifying it in the spec would therefore not change or break their behavior -- it would simply document the de-facto interoperable behavior and give other implementations a clear rule to follow.
Implementation experience (Firefox)
Firefox shipped re-snapping and subsequently hit two separate bugs that a clearer spec would have helped avoid:
- Bug 1779909 -- CSS Scroll Snap re-snapping happens while user is still sliding fingers on trackpad
- Bug 2021952 -- scroll-snap container resnaps during active pan gesture when a CSS scroll-driven animation causes a reflow on descendant
In both cases the user-facing fix was the same: do not re-snap while a scrolling gesture is ongoing; wait until it ends.
Proposed wording
In the re-snapping section, add a note/normative sentence along the lines of:
If a re-snap would be triggered while the scroll container is being scrolled by an ongoing scrolling gesture, the user agent must defer re-snapping until that gesture has ended. The scroll position continues to follow user input during the gesture, and re-snapping is (re-)evaluated once the gesture completes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CSS Scroll Snap re-snapping section linked in the issue and review its existing rules for layout or content changes. Add wording that defers re-snapping during an active scrolling gesture and re-evaluates it after the gesture ends; done means the proposed behavior is clearly specified without changing the stated interoperable behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100