File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export type ScrollPositionCoordinates = {
16
16
17
17
/**
18
18
* Internal normalized version of {@link ScrollPositionCoordinates} that always
19
- * has `left` and `top` coordinates.
19
+ * has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
20
20
*
21
21
* @internal
22
22
*/
@@ -68,11 +68,10 @@ function getElementPosition(
68
68
}
69
69
}
70
70
71
- export const computeScrollPosition = ( ) =>
72
- ( {
73
- left : window . pageXOffset ,
74
- top : window . pageYOffset ,
75
- } as _ScrollPositionNormalized )
71
+ export const computeScrollPosition = ( ) : _ScrollPositionNormalized => ( {
72
+ left : window . scrollX ,
73
+ top : window . scrollY ,
74
+ } )
76
75
77
76
export function scrollToPosition ( position : ScrollPosition ) : void {
78
77
let scrollToOptions : ScrollPositionCoordinates
@@ -146,8 +145,8 @@ export function scrollToPosition(position: ScrollPosition): void {
146
145
window . scrollTo ( scrollToOptions )
147
146
else {
148
147
window . scrollTo (
149
- scrollToOptions . left != null ? scrollToOptions . left : window . pageXOffset ,
150
- scrollToOptions . top != null ? scrollToOptions . top : window . pageYOffset
148
+ scrollToOptions . left != null ? scrollToOptions . left : window . scrollX ,
149
+ scrollToOptions . top != null ? scrollToOptions . top : window . scrollY
151
150
)
152
151
}
153
152
}
You can’t perform that action at this time.
0 commit comments