Skip to content
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

[css-scroll-snap-1] expected behavior when scrolling past a container's last visible element #4111

Closed
justingrant opened this issue Jul 13, 2019 · 3 comments

Comments

@justingrant
Copy link

justingrant commented Jul 13, 2019

What's expected behavior when scroll snap is enabled and the user tries to scroll past the last snap position? Example: https://codepen.io/anon/pen/orOmeP. I'm asking because:

  • WebKit (Mac Safari, iOS any) will scroll to the end, leaving nothing visible in the viewport.
  • Blink (desktop Chrome) will refuse to scroll past the last visible element.

Which is correct? Or is this behavior currently unspecified?

FWIW, the current WebKit behavior causes a race condition that breaks current "virtual scrolling" implementations like Facebook's react-window that use JavaScript to JIT add/move absolutely-positioned elements in an otherwise-empty, very long container to simulate scrolling through a long list. Safari will scroll to the end of the content before the virtual-scrolling script has a chance to move elements to the user's new scroll position. Desktop Chrome doesn't have this problem.

If this behavior isn't specified today, then I'd suggest adopting the Chrome behavior as default in the standard. If it is specified, then is there any standardized way for infinite-scroll implementations to get the Chrome behavior?

@jonjohnjohnson
Copy link

jonjohnjohnson commented Jul 13, 2019

Blink - https://bugs.chromium.org/p/chromium/issues/detail?id=953979
Gecko - https://bugzilla.mozilla.org/show_bug.cgi?id=1545316

IMHO the start/end scrolling boundaries of a scroll container should implicitly create snap boundaries so that users can scroll back to the same position/boundary a scroll container originally loads in against. In short, I support webkits implementation.

Also, I’d suggest changing the title of this filing from referencing the “last visible element” to something regarding “past/before snap aligning elements” that aren’t at the scroll containers boundaries?

@jonjohnjohnson
Copy link

jonjohnjohnson commented Jul 13, 2019

Oh wait, this is actually a dup of an issue, #4037, that I filed last month. 😆

@justingrant
Copy link
Author

Hi @jonjohnjohnson - #4037 definitely looks like the same issue. I'll close this issue and argue discuss with you over there. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants