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:
parent
5297f00635
commit
f9f1bc168c
@ -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;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={keydown} />
|
||||
|
||||
{#if show}
|
||||
<div class="modal outer" on:mousedown|self={() => show = false} transition:fade>
|
||||
<div class="inner" transition:fly={{ y: 100 }}>
|
||||
|
Loading…
Reference in New Issue
Block a user