Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/helpers/tabbable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ function hidesContents(element) {
// If the node is empty, this is good enough
if (zeroSize && !element.innerHTML) return true;

// Otherwise we need to check some styles
const style = window.getComputedStyle(element);
return zeroSize
? style.getPropertyValue("overflow") !== "visible" ||
// if 'overflow: visible' set, check if there is actually any overflow
(element.scrollWidth <= 0 && element.scrollHeight <= 0)
: style.getPropertyValue("display") == "none";
try {
// Otherwise we need to check some styles
const style = window.getComputedStyle(element);
return zeroSize
? style.getPropertyValue("overflow") !== "visible" ||
// if 'overflow: visible' set, check if there is actually any overflow
(element.scrollWidth <= 0 && element.scrollHeight <= 0)
: style.getPropertyValue("display") == "none";
} catch (exception) {
// eslint-disable-next-line no-console
console.warn("Failed to inspect element style");
return false;
}
}

function visible(element) {
Expand Down