Skip to content

View Transition API not working for router.history navigation calls #2983

@scarabcoder

Description

@scarabcoder

Which project does this relate to?

Router

Describe the bug

When navigating through browser history manually using the Tanstack Router BrowserHistory API, native browser transitions (from the new View Transitions API) are not happening. They do occur when using the native window.history API.

Example use case would be a "Back" button that navigates the user back in history.

Your Example Website or App

https://stackblitz.com/edit/github-axehctcy

Steps to Reproduce the Bug or Issue

  1. Load the example app on the "Home" page
  2. Navigate to the "About" page (note the browser default fade transition)
  3. Click the "Back to Previous Page with router.history.back()" button text
  4. Navigation will have no transition

Expected behavior

Navigation should use the same transition that navigating back with the window.history.back() or native browser back button uses. Notice the other button in the example does transition.

Screenshots or Videos

No response

Platform

  • OS: Mac OS
  • Browser: Chrome
  • Version: 131.0.6778.109

Additional context

The notify() call in the browser history source appears to override or cancel out the default transition animation. Is it possible that we do not need to call browser history subscribers in some history events, since native browser events like the user clicking the back button do not do so either?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions