Hacker News new | ask | show | jobs
by madeofpalk 1790 days ago
This behaviour has nothing to do with scroll snapping.

Scroll snapping is just "can i have a carousel without javascript", and is primarily a touch interaction. See this extremely brief demo https://codepen.io/tutsplus/pen/qpJYaK?editors=1100

I wouldn't call Square's site "scroll hijacking" - usually we use that to refer to when the actual native scroll behaviour/events are highjacked and prevented, and custom javascript scrolling happens. Instead on the Square site the DOM page is still scrolling natively, but an animation is progressed depending on the native page position. Maybe not ideal, but its much smoother and less jarring than actual scroll jacking.

2 comments

From TFA:

> For instance, it is easy for a user to land at an awkward scroll position which leaves an item partially on-screen when panning.

> To this end, this module introduces scroll snap positions which enforce the scroll positions that a scroll container’s scrollport may end at after a scrolling operation has completed.

Which is exactly what this page is doing.

> primarily a touch interaction

It's exclusively a scroll interaction, whether the pointer event is the result of mouse or touch input.

> the DOM page is still scrolling natively

I'm not sure what you're trying to say by "DOM page." JS is reacting to the scroll position of the viewport. The user experience is the same.

Sorry to disagree. The interaction you see in the page is not scroll snapping.

With scroll snapping you the user have always control of the scrollable content. What you do not have control over is where it will stop scrolling. A similar behavior to forced guides in a movable element on rails (such as drawers).

This page doesn’t scroll at all, and uses the scroll as a time control for a “movie”. And that is scroll jacking, as it hijacks the scroll position to do something completely different.

This page, at least on mobile, is also guilty of implementing it in the worst way possible: without any alternative scroll indications and without smooth continuous transitions that make it clear that you are controlling the animation through the scroll.

Apple is somewhat better at doing this since the scrolljacking procedure usually brings you to an element which, at the end of a glamourous entrance, actually scrolls away with the page.

It might sound similar, but it's very different in practice.
Does this page enforce the scroll positions that a scroll container’s scrollport may end at after a scrolling operation has completed, in practice?
I tried scrolling that demo with my mouse wheel and it "snapped" quite spastically down to 4. Even once I realized what the intended behavior was, it was still difficult to control: https://youtu.be/1A1c51GFGoc

Seems to work as intended with the touchpad, to the point where it was hard to even tell that the browser was doing something different.