Escape key closes TaskPanel
This commit is contained in:
parent
27930f1aa2
commit
d242dcc028
1 changed files with 8 additions and 0 deletions
|
@ -37,6 +37,12 @@ import TaskDisplay from "./TaskDisplay.svelte";
|
|||
behavior: 'smooth'
|
||||
}), 100)
|
||||
}
|
||||
|
||||
function handleKeydown(e: KeyboardEvent) {
|
||||
if (e.key === "Escape") {
|
||||
close()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -68,6 +74,8 @@ import TaskDisplay from "./TaskDisplay.svelte";
|
|||
.panel.full .closeButton { display: inherit }
|
||||
</style>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<div class="panel {heightClass}"
|
||||
on:click={() => selectedTask && select(selectedTask)}>
|
||||
<TaskDisplay taskId={selectedTask?.id} />
|
||||
|
|
Reference in a new issue