chat-ui / src /lib /components /Portal.svelte
Adrien Denat
Improve modal a11y (#177)
fe5e801 unverified
raw
history blame
312 Bytes
<script lang="ts">
import { onMount, onDestroy } from "svelte";
let el: HTMLElement;
onMount(() => {
el.ownerDocument.body.appendChild(el);
});
onDestroy(() => {
if (el?.parentNode) {
el.parentNode.removeChild(el);
}
});
</script>
<div bind:this={el} class="contents" hidden>
<slot />
</div>