W3C home > Mailing lists > Public > www-style@w3.org > January 2016

[css-scroll-snap][css-snappoints] snapping to unreachable snap points

From: Florian Rivoal <florian@rivoal.net>
Date: Sun, 24 Jan 2016 21:07:13 +0900
Message-Id: <4E8B0F60-3E86-4481-B3D8-F03E8DB86925@rivoal.net>
To: CSS public list <www-style@w3.org>
On the last teleconf, we discussed what happens when you are snapped to a snap point that becomes unreachable due to some relayout, and concluded that the UA must stay snapped to it.

This discussion naturally continues into the question of how we should handle snapping TO an unreachable snap point (from a reachable one or a non snapped position).

The spec says this (since this has yet to be integrated to css-snappoints, I'm going off the css-scroll-snap spec):

> If the most appropriate snap position is unreachable, such that aligning to it would require scrolling the scroll container’s viewport past the edge of its scrollable area, the scroll container must be scrolled as much as possible in each relevant axis toward the desired snap position. This is the used snap position corresponding to that snap position; that is, the UA must “snap” to this position just as it would have if it were the actual specified alignment.

I agree with it for the same reasons I agreed to what we resolved in the last teleconf, including the fact that it says MUST. However, I think ambiguous wording makes it ineffective: this clause can be ignored simply by considering any unreachable position as not being "the most appropriate".

I don't think we should leave that up to entirely user agents, because this isn't really a case of some users liking it one way and some another way; authors need write their content/style differently depending on the behavior, since which behavior we choose can make the difference between content being reachable or not.

Proposal for Axis snapping:

* Under mandatory snapping:
  - when the user makes a semantic scroll in a certain direction
  - or when the user makes an inertial scroll in a certain direction which has enough velocity to escape the current snap point
  - or when the user makes an explicit scroll to the very edge of the scroller
then, if there is an unreachable snap point in that direction, then it is "the most appropriate", and the UA must snap to it.

* Under proximity snapping:
  - when the user makes a semantic scroll in a certain direction that scrolls far enough to reach the edge of the scroller
  - or when the user makes an inertial scroll in a certain direction which has enough velocity to reach the edge of the scroller
  - or when the user makes an explicit scroll to the very edge of the scroller
then, if there is an unreachable snap point in that direction, then it is "the most appropriate", and the UA must snap to it.

In either case, if there are multiple unreachable snap points in the same direction, the UA should only snap to the first one.

For point snapping, it seems that the same criteria apply, with the added constrain that the scroller needs to be on at the right position on the other axis.

In another part, the spec also says:

> Since the purpose of scroll snapping is to align content within the viewport for optimal viewing: in all cases, the specified alignment creates a valid snap position only if at least part of the snap area is within the snap viewport.

I think the intent is about when element is not within the snap viewport due to being off to the side. In that case I think it is fine. However, if it is not off to the side, but instead isn't within the snap viewport due to a large scroll-snap-padding in the direction of the scrolling, I think this should not apply (otherwise it defeats the part of the earlier point).

For example, say you have a 1d scroller, with a large  scroll-snap-padding (maybe because it was expressed as a percentage and the screen is larger than expected), and a small element with a (mandatory) snap-point in it, that is close to or at the edge of the scroller. Even if the element is entirely under the snap padding, it should still qualify as "the most appropriate" and snap when you're trying to scroll to the end, rather than be discounted because it is entirely outside of the snap viewport.

  - Florian
Received on Sunday, 24 January 2016 12:07:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:35 UTC