Skip to content

Commit

Permalink
fix: useLockScroll whether the element scroll is in the end #6253
Browse files Browse the repository at this point in the history
  • Loading branch information
19Qingfeng committed Jul 16, 2023
1 parent 5892da7 commit 092375b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/use-lock-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export function useLockScroll(
}
}

const { scrollHeight, offsetHeight, scrollTop } = el
const { scrollHeight, clientHeight, offsetHeight, scrollTop } = el

Check warning on line 53 in src/utils/use-lock-scroll.ts

View check run for this annotation

Codecov / codecov/patch

src/utils/use-lock-scroll.ts#L53

Added line #L53 was not covered by tests
let status = '11'

if (scrollTop === 0) {
status = offsetHeight >= scrollHeight ? '00' : '01'
} else if (scrollTop + offsetHeight >= scrollHeight) {
} else if (Math.abs(scrollHeight - clientHeight - scrollTop) < 1) {
status = '10'
}

Expand Down

0 comments on commit 092375b

Please sign in to comment.