1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2024-12-01 13:20:54 +00:00

Close modal on Escape press

This commit is contained in:
Romein van Buren 2023-01-15 12:04:36 +01:00
parent 5297f00635
commit f9f1bc168c
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49

View File

@ -5,8 +5,16 @@
export let show = false; export let show = false;
export let title = undefined; export let title = undefined;
export let contentPadding = true; export let contentPadding = true;
function keydown(event) {
if (event.key === 'Escape') {
show = false;
}
}
</script> </script>
<svelte:window on:keydown={keydown} />
{#if show} {#if show}
<div class="modal outer" on:mousedown|self={() => show = false} transition:fade> <div class="modal outer" on:mousedown|self={() => show = false} transition:fade>
<div class="inner" transition:fly={{ y: 100 }}> <div class="inner" transition:fly={{ y: 100 }}>