Skip to content

Commit 8855f24

Browse files
smallnine9yulj5
andauthored
fix(useScroll): support window in setArrivedState (#3086)
Co-authored-by: yulj5 <yulj5@asiainfo.com>
1 parent 31b6626 commit 8855f24

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/core/useScroll/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ export function useScroll(
162162

163163
const setArrivedState = (target: HTMLElement | SVGElement | Window | Document | null | undefined) => {
164164
const el = (
165-
target === document ? (target as Document).documentElement : target
165+
target === window
166+
? (target as Window).document.documentElement
167+
: target === document ? (target as Document).documentElement : target
166168
) as HTMLElement
167169

168170
const { display, flexDirection } = getComputedStyle(el)

0 commit comments

Comments
 (0)