From ff9502ff34790c46f31d175911cd51c9b62804fb Mon Sep 17 00:00:00 2001 From: Shlomo <78599753+ShlomoCode@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:44:00 +0200 Subject: [PATCH] fix: keyboard shortcut to confirm prompts (#2932) --- frontend/src/components/prompts/Prompts.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/prompts/Prompts.vue b/frontend/src/components/prompts/Prompts.vue index 3305be9a..9dfba9cd 100644 --- a/frontend/src/components/prompts/Prompts.vue +++ b/frontend/src/components/prompts/Prompts.vue @@ -62,17 +62,16 @@ export default { window.addEventListener("keydown", (event) => { if (this.currentPrompt == null) return; - let prompt = this.$refs.currentComponent; + const promptName = this.currentPrompt.prompt; + const prompt = this.$refs[promptName]; - // Esc! - if (event.keyCode === 27) { + if (event.code === "Escape") { event.stopImmediatePropagation(); this.$store.commit("closeHovers"); } - // Enter - if (event.keyCode == 13) { - switch (this.currentPrompt.prompt) { + if (event.code === "Enter") { + switch (promptName) { case "delete": prompt.submit(); break;