Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docs/src/ClientApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "./styles.css";

export function ClientApp({ routes, ssrPath }: { routes: RouteDefinition[]; ssrPath?: string }) {
// Auto scroll to top - this should be handled by the browser per spec,
// but currently Chrome and Safari do not follow the spec.
// but Safari and older versions of Chrome do not follow the spec (Chrome 149+ does).
useEffect(() => {
const navigation = window.navigation;
if (!navigation) {
Expand Down
8 changes: 5 additions & 3 deletions packages/docs/src/pages/FaqPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export function FaqPage() {
<h2>Browser doesn't scroll to top after navigation</h2>
<p>
According to the Navigation API specification, the browser should automatically scroll to
the top of the page after a same-document navigation. However, as of now, Chrome and
Safari do not follow this part of the spec.
the top of the page after a same-document navigation. Chrome follows this part of the spec
since version 149, but Safari and Chrome 148 and earlier keep the previous scroll position
instead.
</p>
<p>
As a workaround, you can listen to the <code>navigatesuccess</code> event and scroll to
the top manually:
the top manually. This is harmless in browsers that already follow the spec, since the
page is already at the top:
</p>
<CodeBlock language="tsx">{`import { useEffect } from "react";

Expand Down
Loading