Setting a default CSS scroll snap point
I am trying to implement a scrollable container using CSS scroll snap that defaults to a middle snap point, rather than to the snap point closest to a
scrollTop
position of 0.
I found in Chrome that if I initially rendered without a scroll snap on the first element, then it would snap to the next (middle) element.
Afterwards, I could go back and add the scroll snap point on the first element, so that the user can scroll to it.
Unfortunately, this doesn't work in Safari.
I have a reproduction put together here if anyone would like to help me noodle on it: https://codesandbox.io/p/devbox/773zkw0 Replies