Commit 0369b32
feat(frontend): reset scroll to top on every route navigation
Navigating between pages (e.g. Home -> Privacy Policy) could leave the
user partway down the new page, because the browser kept the previous
page's scroll position.
Reset the scroll to the top from the CSSTransition `onEnter`, i.e. as the
incoming page begins entering. With the out-in transition the old page
fades out at its position, then the new page mounts at the top and fades
in -- so there's no jarring mid-scroll jump; the existing fade/slide is
the smoothness. Tied to the keyed transition (location.pathname), so
in-page hash/anchor links are unaffected.
60 tests / 10 snapshots pass; eslint + prettier clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 5c3b340 commit 0369b32
1 file changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
| |||
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| 103 | + | |
91 | 104 | | |
92 | 105 | | |
93 | 106 | | |
| |||
0 commit comments