Skip to content
Permalink
Browse files

fix(utilities-dom): use window.getComputedStyle for hasOverflowScroll

  • Loading branch information...
jorgenskogas committed Mar 27, 2019
1 parent 877ba63 commit 4b015d2835a993f7ae802ea5e8c297e56e4b156e
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/utilities-dom.ts
@@ -30,10 +30,10 @@ export const getElementDistanceToTopOfDocument = (element: Element): number => {
};

/**
* Check if an element has inline style scroll/auto for overflow/overflowY
* Check if an element has style scroll/auto for overflow/overflowY
*/
export const hasOverflowScroll = (element: HTMLElement): boolean => {
let style = element.style;
export const hasOverflowScroll = (element): boolean => {
let style = element !== document ? window.getComputedStyle(element) : undefined;
return style && (style.overflowY === 'scroll' || style.overflow === 'scroll' || style.overflowY === 'auto' || style.overflow === 'auto');
};

0 comments on commit 4b015d2

Please sign in to comment.
You can’t perform that action at this time.