diff --git a/src/ComposedModal/ComposedModal.svelte b/src/ComposedModal/ComposedModal.svelte index f0ea91a2..44c62f9d 100644 --- a/src/ComposedModal/ComposedModal.svelte +++ b/src/ComposedModal/ComposedModal.svelte @@ -83,7 +83,9 @@ }); onDestroy(() => { - 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"); + } }); afterUpdate(() => { @@ -91,7 +93,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;