bestguy / sveltestrap

Bootstrap 4 & 5 components for Svelte
https://sveltestrap.js.org
MIT License
1.31k stars 183 forks source link

Modal over a Modal - no Backdrop on first one #263

Open vfilatov opened 3 years ago

vfilatov commented 3 years ago

If you put another Modal inside of ModalBody, the parent doesn't get grey. It was working fine in "sveltestrap": "^3.13.0"

https://svelte.dev/repl/f96a0919e17546e4930c52e5d860a6cc?version=3.37.0

vfilatov commented 3 years ago

Looks it got broken in 4.0.0-beta.1 as it still was working in 4.0.0-alpha.5

vfilatov commented 3 years ago

workaround

add container prop to the second Modal

<Modal isOpen={open2} {toggle2} size="sm" container="inline">
    <ModalHeader {toggle2}>Another Modal title</ModalHeader>
    <ModalBody>But, it does not</ModalBody>
    <ModalFooter>
        <Button color="secondary" on:click={toggle2}>Cancel</Button>
    </ModalFooter>
</Modal>
bestguy commented 3 years ago

Thanks, yes we thought defaulting to append to body was a better default, but happy to look at what's breaking here.

bestguy commented 3 years ago

So officially Bootstrap does not support multiple modals, and looking at the backdrop styles Bootstrap provides they use fixed z-index values that are always under the modals - so I'm not clear how it should/could work in this use case.

I'm leaning towards your workaround being the "official" way we could support multiple Modals, and thinking we could close the issue. (We can update docs if useful). Thoughts on this @vfilatov ?

vfilatov commented 3 years ago

I'm fine with close this issue as long as "workaround" works :) Would nice to add an example to the demo page.

bestguy commented 3 years ago

Cool I'll update docs before closing. Thanks for the heads up.