-
Notifications
You must be signed in to change notification settings - Fork 715
[css-scroll-snap-2] Should scrollsnapchanging target the currently visible element during flings #10838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think @argyleink would prefer to see a different event for this. |
yeah, the most common description among my queried community was "fly over", but the technical term is closer to "scrollSnapAxisCross" or "scrollSnapOverAxis". I do think this is a nice addition, it's in-between the current features in terms of information, and it does open up the information that's otherwise private or hard to decipher for authors. question: is intersection observer already built for this purpose? |
Do you have particular use cases for which you think that the current behavior on flings is better? Or are they the ones in those demos? In my experience, I haven't seen websites or native applications where a fling predicts the destination beyond the next item. Maybe we could prototype whatever the most compelling use cases are and spot check / vote whether the current behavior or my proposed change is better or whether there are use cases for both? |
i think almost all of the examples are better with the current behavior, except maybe the ruler.
agree, me neither. but i also don't think that makes them better, but it does mean it's more familiar.
you know my feelings about prototypes! they can speak 1000 words. let's do it.
i think if i used random thoughts |
Right, this would produce the expected behavior for flings, but it would mean that clicking on an anchor link, e.g. the 5 in my demo would also slowly step through each element, delaying the feedback that you have selected the 5th page. For targeted scrolls, it makes sense that the user has an expectation about where it is going and so expects immediate feedback about the target location. I have two main concerns about predicting the fling:
I'll prototype something up to make it easy to compare the two which I think will help with deciding on one of three outcomes:
|
Okay, I've put together a demo that lets you compare two strategies for scrollsnapchanging (use chrome canary with experimental web platform features enabled): In the demo, you can select from:
I propose that the targeted location is better than the current native behavior. In particular, when you fling the native behavior jumps ahead by several items quickly. Using the targeted location instead of always using the current location is necessary to ensure that clicking on a particular location immediately selects it. |
Thanks for the demo, so nice to feel these things out. Targeted location 👍🏻 |
+1 on Targeted Location |
The CSS Working Group just discussed
The full IRC log of that discussion<TabAtkins> flackr: we defined scrollsnapchanging as using the "eventual scrol lpositition". this makes sense for targeted scrolls, but is confusing when flinging.<TabAtkins> flackr: we'll predict a position far out, but if you change your scroll velocity the identified item jumps back to the one currently in view <TabAtkins> flackr: proposing we change the behavior so that targeted scrolls (where we know the intended destination) that we use that target (as the spec already says), but for momentum scrolls we use the current position, as if you're actively scrolling and we don't know where you'll end up <TabAtkins> flackr: this is more intuitive, where the identified item doesn't jump ahead of your scroll <TabAtkins> +1, this sounds right. I'd expect indicated element to gradually move as the fling progresses <TabAtkins> astearns: are you going to be able to tell what kind of things you're getting back? <TabAtkins> astearns: targeted vs currnet scroll position? <TabAtkins> flackr: API doesn't differentiate, you just get a currentTarget <TabAtkins> flackr: for all the use-cases we've been talking about this feels right, but it's possible we might want something always based on the current location. <TabAtkins> flackr: doesn't make sense to have something always based on target location; sometimes you don't have a different target location. <TabAtkins> flackr: but if we eventaully wanted one for the currently-in-view thing even during a targeted scroll, we could add it <TabAtkins> astearns: i don't have a particular reason to need it, was just wondering <TabAtkins> flackr: yeah, for all use-cases we know - carousel, selected UI - it makes sense to use current or target as i'm proposing here, depending on type of scroll <TabAtkins> astearns: other questions? <TabAtkins> astearns: summary? <TabAtkins> flackr: proposed resolution: scrollsnapchanging uses the targeted location for targeted scrolls, but does not predict the destination of momentum scrolling (uses the current scroll location instead) <TabAtkins> RESOLVED: scrollsnapchanging uses the targeted location for targeted scrolls, but does not predict the destination of momentum scrolling (uses the current scroll location instead) |
The css-scroll-snap-2 spec says the following about scrollsnapchanging:
For the case where the user is or was interacting and initiated a fling, Chrome determines the eventual snap target which can mean that we immediately dispatch a
scrollsnapchanging
event for the location the scroll will eventually land even if it will pass over the areas which would normally snap to other elements first. This was called out in the Scroll Snap Events article and is illustrated by several of the demos such as the scrollsnapchanging visualizer demo.Note that the spec text does not seem to imply this behavior - since it says in the latter case referring to cases where it "might directly track a user's input (e.g. touch scrolling, scrollbar dragging)" that it is intended to use the current scroll offset, so it would seem that my desired outcome might match the spec but not chrome.
I think for cases where you have clicked on an anchor link and we are executing a smooth scroll to a predetermined location, using the eventual target is a better experience than flipping through all of the snap targets as they fly by (demo), however, during a scroll interaction having the tracked item switch from on screen (while the finger is down) to the eventual target offscreen after you lift your finger and start a fling feels unintuitive to me (e.g. fling in the previous demo or this ruler demo for a more obvious example where it feels unintuitive).
The text was updated successfully, but these errors were encountered: