fix: add fallback to Modal portal container
This commit is contained in:
@@ -18,7 +18,7 @@ export function Modal({
|
|||||||
if (!isOpen) return null;
|
if (!isOpen) return null;
|
||||||
// render the modal top of all elements and position them to document viewport (/ the main wrapper).
|
// render the modal top of all elements and position them to document viewport (/ the main wrapper).
|
||||||
// NOTE: this is recommended approach for modals as it shouldn't be bound to the parent box.
|
// NOTE: this is recommended approach for modals as it shouldn't be bound to the parent box.
|
||||||
const mainContainer = document.querySelector("main");
|
const mainContainer = document.querySelector("main") || document.body;
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<div
|
<div
|
||||||
data-testid={testId}
|
data-testid={testId}
|
||||||
|
|||||||
Reference in New Issue
Block a user