We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 877ba63 commit 4b015d2Copy full SHA for 4b015d2
src/utilities-dom.ts
@@ -30,10 +30,10 @@ export const getElementDistanceToTopOfDocument = (element: Element): number => {
30
};
31
32
/**
33
- * Check if an element has inline style scroll/auto for overflow/overflowY
+ * Check if an element has style scroll/auto for overflow/overflowY
34
*/
35
-export const hasOverflowScroll = (element: HTMLElement): boolean => {
36
- let style = element.style;
+export const hasOverflowScroll = (element): boolean => {
+ let style = element !== document ? window.getComputedStyle(element) : undefined;
37
return style && (style.overflowY === 'scroll' || style.overflow === 'scroll' || style.overflowY === 'auto' || style.overflow === 'auto');
38
39
0 commit comments