Skip to content

Scroll state carrying over to different page #6140

@zocke1r

Description

@zocke1r

Which project does this relate to?

Router

Describe the bug

When navigating from an index to a $details page. The scroll state carries over causing the new page to be loaded with the same scroll position as the index page. Setting scrollRestoration: true in createRouter fixes the issue.

Your Example Website or App

https://github.com/zocke1r/scrroll-repro

Steps to Reproduce the Bug or Issue

  1. Navigate to /cards
  2. scroll to the bottom of the page
  3. Click on yellow block
  4. Observe Scroll state on details page
  5. Go Back
  6. scroll to top
  7. Click on yellow block
  8. observe Scroll state on details page

Expected behavior

As a user i would expect that when navigating to a different page, the new page gets displayed scrolled to the top, no matter where i was on the previous page.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.141.2
  • OS: Windows
  • Browser: Chrome [e.g. Chrome, Safari, Firefox]
  • Browser Version: 143.0.7499.41
  • Bundler: vite
  • Bundler Version: 7.2.7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions