diff --git a/app/src/lib/components/Modal.svelte b/app/src/lib/components/Modal.svelte index b7650e9fb..960157724 100644 --- a/app/src/lib/components/Modal.svelte +++ b/app/src/lib/components/Modal.svelte @@ -4,7 +4,9 @@ import type iconsJson from '$lib/icons/icons.json'; let dialog: HTMLDialogElement; + let modalForm: HTMLFormElement; let item: any; + let open = false; export let width: 'default' | 'small' | 'large' = 'default'; export let title: string | undefined = undefined; @@ -13,19 +15,21 @@ export function show(newItem?: any) { item = newItem; dialog.showModal(); + open = true; } export function close() { item = undefined; dialog.close(); + open = false; } - //onMount(() => { - // document.body.appendChild(dialog); - //}); + onMount(() => { + document.body.appendChild(dialog); + }); function handleClickOutside(e: MouseEvent) { - if (dialog && !dialog.contains(e.target as Node)) { + if (!modalForm.contains(e.target as Node)) { dialog.close(); } } @@ -34,15 +38,14 @@ -
- -
+ {/if}