Skip to content

Commit 4b015d2

Browse files
committed
fix(utilities-dom): use window.getComputedStyle for hasOverflowScroll
1 parent 877ba63 commit 4b015d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utilities-dom.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ export const getElementDistanceToTopOfDocument = (element: Element): number => {
3030
};
3131

3232
/**
33-
* Check if an element has inline style scroll/auto for overflow/overflowY
33+
* Check if an element has style scroll/auto for overflow/overflowY
3434
*/
35-
export const hasOverflowScroll = (element: HTMLElement): boolean => {
36-
let style = element.style;
35+
export const hasOverflowScroll = (element): boolean => {
36+
let style = element !== document ? window.getComputedStyle(element) : undefined;
3737
return style && (style.overflowY === 'scroll' || style.overflow === 'scroll' || style.overflowY === 'auto' || style.overflow === 'auto');
3838
};
3939

0 commit comments

Comments
 (0)