Skip to content

Commit

Permalink
fix(useScrollLock): detect parent with overflow auto (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpschen committed Feb 18, 2023
1 parent db66c02 commit 7e5901e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/useScrollLock/index.ts
Expand Up @@ -6,7 +6,12 @@ import { useEventListener } from '../useEventListener'

function checkOverflowScroll(ele: Element): boolean {
const style = window.getComputedStyle(ele)
if (style.overflowX === 'scroll' || style.overflowY === 'scroll') {
if (
style.overflowX === 'scroll'
|| style.overflowY === 'scroll'
|| (style.overflowX === 'auto' && ele.clientHeight < ele.scrollHeight)
|| (style.overflowY === 'auto' && ele.clientWidth < ele.scrollWidth)
) {
return true
}
else {
Expand Down

0 comments on commit 7e5901e

Please sign in to comment.