Skip to content

Commit

Permalink
Close the About modal by pressing enter or escape
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Jan 21, 2024
1 parent e50c063 commit 9eb5db8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/src/common/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
}
}
}
function onKeyDown(e: KeyboardEvent) {
if (e.key == "Escape" || e.key == "Enter") {
e.stopPropagation();
dialog.close();
}
}
</script>

<svelte:window on:click={onClick} />
<svelte:window on:click={onClick} on:keydown={onKeyDown} />

<dialog open on:close bind:this={dialog}>
<div>
Expand Down

0 comments on commit 9eb5db8

Please sign in to comment.