-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hacky fix to unwanted scroll preservation, should do something nicer …
…later The issue is the Layout component div being 100vh, which means the default scroll to top doesn't work. Need to find a way to get around that without breaking everything.
- Loading branch information
Showing
3 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useLayoutEffect } from "react"; | ||
|
||
export function ScrollReset() { | ||
useLayoutEffect(() => { | ||
document.querySelector("#root > div")?.scrollTo({ top: 0, behavior: "smooth" }); | ||
}); | ||
return null; | ||
} |