WICG / virtual-scroller

Other
2k stars 83 forks source link

Customizing Scroll Behaviour #121

Closed bennypowers closed 5 years ago

bennypowers commented 6 years ago

I'd like to implement something like scroll-snap using <virtual-scroller>. To that end, it would be awesome if I could override the scrolling behaviour.

domenic commented 6 years ago

Hmm. My inclination is that this would be orthogonal to virtual-scroller, which just uses the browsers default scroll behavior. That is, if you want to customize scroll behavior, that's a more general ask, and virtual-scroller ideally shouldn't do anything special (just like iframes and <div style="overflow: auto"> don't do anything special).

Is there a reason scroll-snap doesn't work with virtual-scroller? Alternately, do native CSS snap points work with virtual scroller?

bennypowers commented 6 years ago

When I tried using scroll snap, I had all sorts of weird behaviours - mostly elements jumping all over the screen. I had some success rolling my own with intersection observer and scrollIntoView

domenic commented 5 years ago

With the new approach outlined in the explainer, this should work as I'd hoped above, with native platform features like scroll-snap "just working". Since this repository is now focused around a spec proposal (see https://github.com/valdrinkoshi/virtual-scroller/issues/158#issuecomment-480913127), I don't think there's much more to do here, so I'll close this.

But, to be clear, this will be an important thing for implementers of the proposal to get right, and we'll make sure to emphasize that in the spec and tests!