Skip to content

Commit

Permalink
Adding a check to see if the element is a prototype of Element before…
Browse files Browse the repository at this point in the history
… getting the computed style
  • Loading branch information
beekermememe authored and diasbruno committed Jun 1, 2021
1 parent 827796d commit 31d59b2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/helpers/tabbable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ function hidesContents(element) {
// If the node is empty, this is good enough
if (zeroSize && !element.innerHTML) return true;

// if the element is not of type Element e.g. shadowRoot
// we cannot go any further
if (!element.isPrototypeOf(Element)) {
return false;
}

// Otherwise we need to check some styles
const style = window.getComputedStyle(element);
return zeroSize
Expand Down

0 comments on commit 31d59b2

Please sign in to comment.