| 51 | } |
| 52 | |
| 53 | export 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 | |
| 77 | export function hide(appElement) { |
| 78 | for (let el of validateElement(appElement)) { |