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

Function validateElement

src/helpers/ariaAppHider.js:53–75  ·  view source on GitHub ↗
(appElement)

Source from the content-addressed store, hash-verified

51}
52
53export function validateElement(appElement) {
54 const el = appElement || globalElement;
55 if (el) {
56 return Array.isArray(el) ||
57 el instanceof HTMLCollection ||
58 el instanceof NodeList
59 ? el
60 : [el];
61 } else {
62 warning(
63 false,
64 [
65 "react-modal: App element is not defined.",
66 "Please use `Modal.setAppElement(el)` or set `appElement={el}`.",
67 "This is needed so screen readers don't see main content",
68 "when modal is opened. It is not recommended, but you can opt-out",
69 "by setting `ariaHideApp={false}`."
70 ].join(" ")
71 );
72
73 return [];
74 }
75}
76
77export function hide(appElement) {
78 for (let el of validateElement(appElement)) {

Callers 2

hideFunction · 0.85
showFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected