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 = {
1616
1717/**
1818 * 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.
2020 *
2121 * @internal
2222 */
@@ -68,11 +68,10 @@ function getElementPosition(
6868 }
6969}
7070
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+ } )
7675
7776export function scrollToPosition ( position : ScrollPosition ) : void {
7877 let scrollToOptions : ScrollPositionCoordinates
@@ -146,8 +145,8 @@ export function scrollToPosition(position: ScrollPosition): void {
146145 window . scrollTo ( scrollToOptions )
147146 else {
148147 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
151150 )
152151 }
153152}
You can’t perform that action at this time.
0 commit comments