You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: store scroll position for page with the same location
This will mean that even when not using back/forward buttons,
the scroll position will be restored as long as it is the same
url with the same parameters.
Copy file name to clipboardExpand all lines: README.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,6 +114,13 @@ Default: true
114
114
115
115
True to set Next.js Link default `scroll` property to `false`, false otherwise. Since the goal of this package is to manually control the scroll, you don't want Next.js default behavior of scrolling to top when clicking links.
116
116
117
+
#### restoreSameLocation?
118
+
119
+
Type: `boolean`
120
+
Default: false
121
+
122
+
True to enable scroll restoration when the same location is navigated. By default, only going backwards and forward in the browser history will cause the scroll position to be restored.
it('should set history.scrollRestoration to manual, even on Safari iOS',()=>{
77
83
// eslint-disable-next-line max-len
78
84
navigator.userAgent='Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/605.1';
@@ -377,3 +383,55 @@ it('should update scroll correctly based on history changes', async () => {
0 commit comments