Skip to content

Commit 57768d9

Browse files
Scroll up before animating.
1 parent 91f8049 commit 57768d9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

client/dashboard/app/layout.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ import { getRouter } from './router';
1010
function RouterProviderWithAuth( { config }: { config: AppConfig } ) {
1111
const auth = useAuth();
1212
const router = useMemo( () => getRouter( config ), [ config ] );
13+
14+
router.subscribe( 'onBeforeLoad', () => {
15+
if ( document.startViewTransition ) {
16+
document.startViewTransition( () => {
17+
window.scrollTo( 0, 0 );
18+
} );
19+
}
20+
} );
21+
1322
return <RouterProvider router={ router } context={ { auth, config } } />;
1423
}
1524

0 commit comments

Comments
 (0)