diff --git a/src/components/modal.jsx b/src/components/modal.jsx index f1aaaf0e..0587b3ce 100644 --- a/src/components/modal.jsx +++ b/src/components/modal.jsx @@ -41,6 +41,24 @@ function Modal({ children, onClose, onClick, class: className }) { ); useCloseWatcher(onClose, [onClose]); + useEffect(() => { + const $deckContainers = document.querySelectorAll('.deck-container'); + if (children) { + $deckContainers.forEach(($deckContainer) => { + $deckContainer.setAttribute('inert', ''); + }); + } else { + $deckContainers.forEach(($deckContainer) => { + $deckContainer.removeAttribute('inert'); + }); + } + return () => { + $deckContainers.forEach(($deckContainer) => { + $deckContainer.removeAttribute('inert'); + }); + }; + }, [children]); + const Modal = (