MCPcopy Create free account
hub / github.com/reactjs/react-modal / hidesContents

Function hidesContents

src/helpers/tabbable.js:26–44  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

24}
25
26function hidesContents(element) {
27 const zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;
28
29 // If the node is empty, this is good enough
30 if (zeroSize && !element.innerHTML) return true;
31
32 try {
33 // Otherwise we need to check some styles
34 const style = window.getComputedStyle(element);
35 const displayValue = style.getPropertyValue("display");
36 return zeroSize
37 ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style)
38 : displayValue === DISPLAY_NONE;
39 } catch (exception) {
40 // eslint-disable-next-line no-console
41 console.warn("Failed to inspect element style");
42 return false;
43 }
44}
45
46function visible(element) {
47 let parentElement = element;

Callers 1

visibleFunction · 0.85

Calls 1

isNotOverflowingFunction · 0.85

Tested by

no test coverage detected