swup / scroll-plugin

A swup plugin for smooth scrolling 🏄‍♂️

Home Page:https://swup.js.org/plugins/scroll-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make `shouldResetScrollPosition` work for non-link requests

daun opened this issue · comments

  • Currently, shouldResetScrollPosition passes in a link element
  • We should make sure this still works for form requests or API requests
  • The API of ignoreVisit probably makes sense to emulate here
options = {
  shouldResetScrollPosition: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean
}

How important is this feature to you?

  • Nice to have
  • Would make my life a lot easier
  • I cannot use swup without it

Just realized this is completely obsolete in swup 4 — we can just set context.scroll.reset to false in the transitionStart hook.