diff --git a/src/helpers/tabbable.js b/src/helpers/tabbable.js index f83f1480..8a64bd9a 100644 --- a/src/helpers/tabbable.js +++ b/src/helpers/tabbable.js @@ -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