Navigation between pages is always preserving scroll

Viewed 39

I have a standard Laravel, Inertia.js, Vue.js v3 setup with Vite, and as Inertia docs says, navigation between pages should mimic browser default behavior, reseting scroll to top when page loads. But it is not working this way in my case.

I don't have preserveScroll: true in my links but this happens anyway.

1 Answers

I Solved it temporarily until someone give a solution ;')

in Layout.vue

    mounted(){
       Inertia.on('success', () =>
           window.scrollTo({ top: 0, left: 0, behavior: 'instant' })
       )
    }
Related