diff --git a/ui/src/components/calendar/MultiModal.vue b/ui/src/components/calendar/MultiModal.vue index a3825dd..81269ec 100644 --- a/ui/src/components/calendar/MultiModal.vue +++ b/ui/src/components/calendar/MultiModal.vue @@ -23,10 +23,16 @@ export default class extends Vue { public progress = false; public image_src = ""; - public created() { - window.addEventListener("keydown", (e) => { - if (e.key == "Escape") this.set_active(false); - }); + private on_keydown(e: KeyboardEvent) { + if (e.key == "Escape") this.set_active(false); + } + + public mounted(): void { + window.addEventListener("keydown", this.on_keydown); + } + + public beforeUnmount(): void { + window.removeEventListener("keydown", this.on_keydown); } public set_active(state: boolean) {