diff --git a/src/Modal/Modal.svelte b/src/Modal/Modal.svelte index 3f12276f..4f123138 100644 --- a/src/Modal/Modal.svelte +++ b/src/Modal/Modal.svelte @@ -132,7 +132,9 @@ onMount(() => { return () => { - document.body.classList.remove("bx--body--with-modal-open"); + if(document.querySelectorAll('.bx--modal.is-visible').length === 0) { + document.body.classList.remove("bx--body--with-modal-open"); + } }; }); @@ -141,7 +143,9 @@ if (!open) { opened = false; dispatch("close"); - document.body.classList.remove("bx--body--with-modal-open"); + if(document.querySelectorAll('.bx--modal.is-visible').length === 0) { + document.body.classList.remove("bx--body--with-modal-open"); + } } } else if (open) { opened = true;