The scroll to top issue

The tracking issue #19239 and my original comment available here.

Problem

#

As for Nuxt 3.5 - 3.6.0 (and maybe later), scroll to top feature is not working:

definePageMeta({
  scrollToTop: true,
})

This article describes temporary solution which allows to return this functionally without changing page code.

Solution

#

All is you need is to add next plugin in Nuxt:

export default defineNuxtPlugin({
  name: 'scroll-client',
  hooks: {
    'page:finish': () => {
      if (!useRouter().currentRoute.value.meta.scrollToTop)
        return

      document.scrollingElement?.scrollTo({ left: 0, top: 0 })
      document.body?.scrollTo({ left: 0, top: 0 })
    },
  },
})

As for this website page:transition:finish hook is working incorrectly and cause to some animations fail (e.g. slide-enter animation for a blog post is incorrect on this hook). But it seems to be fine working solution (page:finish hook) with the transitions.

Anyway, you free to experiment with this in your project