swup / scroll-plugin

A swup plugin for smooth scrolling 🏄‍♂️
https://swup.js.org/plugins/scroll-plugin
MIT License
3 stars 8 forks source link

Scroll options not applied correctly #64

Closed daun closed 1 year ago

daun commented 1 year ago

Description of the issue

With the switch to scroll:top and scroll:anchor, we've lost the ability to distinguish top/anchor scrolling on the same page vs. top/anchor scrolling after a page load. Inside the scroll:* handler, there is no way of knowing if the scrolling is part of a visit or a same-page hash-scroll. This means that the animateScroll option is applied incorrectly.

How to reproduce the issue

Set animateScroll to non-equal values:

animateScroll: {
  betweenPages: false,
  samePageWithHash: true,
  samePage: true
}
daun commented 1 year ago

I think I'm just hallucinating things now — everything's working as expected :)