From f9f1bc168ce2e1c626c13fb16e35eed78eed8ac9 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Sun, 15 Jan 2023 12:04:36 +0100 Subject: [PATCH] Close modal on Escape press --- frontend/src/components/modal.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/components/modal.svelte b/frontend/src/components/modal.svelte index 3138f01..36e21a5 100644 --- a/frontend/src/components/modal.svelte +++ b/frontend/src/components/modal.svelte @@ -5,8 +5,16 @@ export let show = false; export let title = undefined; export let contentPadding = true; + + function keydown(event) { + if (event.key === 'Escape') { + show = false; + } + } + + {#if show}