-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
Which project does this relate to?
Router
Describe the bug
On safari and browser that have default navigation transitions it clashes with view transitions.
Your Example Website or App
Steps to Reproduce the Bug or Issue
- Have the router set up to do page transitions on navigate
- On a safari browser use swipe to navigate back or forward
- Observe seeing two animation: safari's and the view transition
Expected behavior
I only see the default browser animation and not the view transition (we can't do the other way)
This is relatively easy to fix but I think it should be apart of the router itself
import { createRouter } from "@tanstack/react-router";
import { routeTree } from "./routeTree.gen";
let uaVisualTransitionDetected = false;
function installUANavigationTransitionDetection() {
if (globalThis.document === undefined) return;
navigation.addEventListener("navigate", (event) => {
uaVisualTransitionDetected = Boolean(event.hasUAVisualTransition);
});
}
export const getRouter = () => {
installUANavigationTransitionDetection();
const router = createRouter({
routeTree,
defaultViewTransition: {
types: () => {
if (uaVisualTransitionDetected) {
uaVisualTransitionDetected = false;
return false;
}
return [];
},
},
});
return router;
};Screenshots or Videos
No response
Platform
- Router / Start Version: 1.159.0
- OS: macOS
- Browser: Safari
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels