function hidesContents()

in src/helpers/tabbable.js [15:34]


function hidesContents(element) {
  const zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;

  // If the node is empty, this is good enough
  if (zeroSize && !element.innerHTML) return true;

  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;
  }
}