diff --git a/frontend/src/lib/components/ImageDisplayModal.svelte b/frontend/src/lib/components/ImageDisplayModal.svelte index c13855b..f4c8661 100644 --- a/frontend/src/lib/components/ImageDisplayModal.svelte +++ b/frontend/src/lib/components/ImageDisplayModal.svelte @@ -3,7 +3,6 @@ const dispatch = createEventDispatcher(); import { onMount } from 'svelte'; let modal: HTMLDialogElement; - import { appVersion, copyrightYear, versionChangelog } from '$lib/config'; import type { Adventure } from '$lib/types'; export let image: string; @@ -18,25 +17,59 @@ function close() { dispatch('close'); + if (modal) { + modal.close(); + } } function handleKeydown(event: KeyboardEvent) { if (event.key === 'Escape') { - dispatch('close'); + close(); + } + } + + function handleClickOutside(event: MouseEvent) { + if (event.target === modal) { + close(); } } - + + + +