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
{{ message }}
Repository navigation
[css-scroll-snap-1] Clarification of interaction between mandatory strictness and visibility requirement #2526
If specified on a scroll container, the scroll container is required to be snapped to a snap position when there are no active scrolling operations. If a reachable snap position exists then the scroll container must snap at the termination of a scroll (if none exist then no snapping occurs).
This is followed by a note which in particular explains this situation:
if authors assign mandatory snapping to non-adjacent siblings, content in between can become inaccessible in cases where it is longer than the screen.
Here is how I understand a generic algorithm that implements this will work:
Compute a set of valid snap position only including positions contributed from snap areas that are considered visible
If the above set is empty, we should not snap even with mandatory strictness
Otherwise, we should choose a snap position and snap.
Issue
If this is the right understanding, I think the none normative text is confusing and incorrect. In particular, larger than snapport content between two adjacent snap points does not become inaccessible even when with mandatory strictness. This is because if user scroll ends in that area, those snap positions are outside snapports and thus not valid, therefore we do not snap.
Yes, the visibility thing is about the other axis, it's the case described in the drawing in https://drafts.csswg.org/css-scroll-snap/#snap-scope -- you can't be “snapped” to a thing you can't see. But if there's a snap position further off-screen and when you snap to it, the box is visible, that's fine.
In other words, https://drafts.csswg.org/css-scroll-snap/#snap-scope says that the state of being snapped requires that the thing you're snapped to must be visible. It doesn't say that you can't snap to a thing which is currently off-screen but would become on-screen after you have snapped to it.
Since the purpose of scroll snapping is to align content within the viewport for optimal viewing, a scroll position cannot be considered a valid snap position if snapping to it would leave the contributing snap area entirely outside the snapport, even if it otherwise satisfies the required alignment of the snap area.
Activity
fantasai commentedon Apr 11, 2018
Yes, the visibility thing is about the other axis, it's the case described in the drawing in https://drafts.csswg.org/css-scroll-snap/#snap-scope -- you can't be “snapped” to a thing you can't see. But if there's a snap position further off-screen and when you snap to it, the box is visible, that's fine.
fantasai commentedon Apr 11, 2018
In other words, https://drafts.csswg.org/css-scroll-snap/#snap-scope says that the state of being snapped requires that the thing you're snapped to must be visible. It doesn't say that you can't snap to a thing which is currently off-screen but would become on-screen after you have snapped to it.
tabatkins commentedon Jun 21, 2018
Okay, we just rephrased that section a bit:
Does this work for you?
majido commentedon Aug 3, 2018
The proposed wording above sounds good to me!
Update wpt scroll-to-visible-areas tests
Update wpt scroll-to-visible-areas tests
Update wpt scroll-to-visible-areas tests
Update wpt scroll-to-visible-areas tests
Update wpt scroll-to-visible-areas tests
Bug 1580772 [wpt PR 19007] - Update wpt scroll-to-visible-areas tests…
Bug 1580772 [wpt PR 19007] - Update wpt scroll-to-visible-areas tests…
Bug 1580772 [wpt PR 19007] - Update wpt scroll-to-visible-areas tests…
Bug 1580772 [wpt PR 19007] - Update wpt scroll-to-visible-areas tests…
Bug 1580772 [wpt PR 19007] - Update wpt scroll-to-visible-areas tests…
Bug 1580772 [wpt PR 19007] - Update wpt scroll-to-visible-areas tests…