From 7e5901ed647d8ee9df8d0d488c32ed22bc426f75 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Sat, 18 Feb 2023 10:43:16 +0100 Subject: [PATCH] fix(useScrollLock): detect parent with overflow auto (#2699) --- packages/core/useScrollLock/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/useScrollLock/index.ts b/packages/core/useScrollLock/index.ts index 7768478f26c..11bd5a27f54 100644 --- a/packages/core/useScrollLock/index.ts +++ b/packages/core/useScrollLock/index.ts @@ -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 {