Skip to content

Page scroll to top before transition has started using NuxtPage transition #31650

@leogenot

Description

@leogenot

Environment


  • Operating System: Linux
  • Node Version: v18.20.3
  • Nuxt Version: 3.16.2
  • CLI Version: 3.24.0
  • Nitro Version: 2.11.8
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: devtools, compatibilityDate, app
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Create new project
Setup pages
Set NuxtPage transitions to :
<nuxt-page :transition="{ name: 'page-fade', mode: 'out-in', }" />
Make pages taller than screen height
Change page using nuxt link

Describe the bug

Reproduction / Stackblitz

Page scroll to top before page transition is triggered making the page jump before shifting.

This issue only occurs when using the NuxtPage transition props alone without setting
app:{pageTransition: true,} in nuxt config

Screen.Recording.2025-04-02.at.16.58.54.mov

Additional context

Nuxt Config (nuxt.config.ts)

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: false },
  compatibilityDate: '2025-04-02',
  app: {
    // pageTransition: true,
  },
});

App (app.vue)

<template>
  <div>
    <NuxtPage
      :transition="{
        name: 'page-fade',
        mode: 'out-in',
      }"
    />
  </div>
</template>

<style>
/* FADE */
.page-fade-enter-active,
.page-fade-leave-active {
  transition: opacity 0.45s ease-in-out;
}

.page-fade-enter-from,
.page-fade-leave-to {
  opacity: 0;
}
</style>

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions