Skip to content

Commit

Permalink
fix(useScroll): evade edge case when window or document is Proxy (#3280)
Browse files Browse the repository at this point in the history
  • Loading branch information
MinatoHikari committed Aug 25, 2023
1 parent a9c8b06 commit c1b296c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/useScroll/index.ts
Expand Up @@ -170,9 +170,9 @@ export function useScroll(
return

const el = (
target === window
(target as Window).document
? (target as Window).document.documentElement
: target === window.document ? (target as Document).documentElement : target
: (target as Document).documentElement ?? target
) as HTMLElement

const { display, flexDirection } = getComputedStyle(el)
Expand Down Expand Up @@ -233,7 +233,7 @@ export function useScroll(
return

const eventTarget = (
e.target === window.document ? (e.target as Document).documentElement : e.target
(e.target as Document).documentElement ?? e.target
) as HTMLElement

setArrivedState(eventTarget)
Expand Down

0 comments on commit c1b296c

Please sign in to comment.