fix: add fallback to Modal portal container

This commit is contained in:
me
2026-05-08 21:19:54 +05:30
parent a7cced71ee
commit ffe588c3ec
+1 -1
View File
@@ -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}