aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-06-20 00:04:00 +0200
committer0neGal <mail@0negal.com>2024-06-20 00:04:00 +0200
commit0f40ecfdf1d351762e6b0bc525b3d716756c5643 (patch)
treeaece4d04c567ff6707ca44c415bbad432a1512af
parentd3e8bcc645a16fbbcf2893d2b077c1e104f30a0a (diff)
downloadViper-0f40ecfdf1d351762e6b0bc525b3d716756c5643.tar.gz
Viper-0f40ecfdf1d351762e6b0bc525b3d716756c5643.zip
fixed Escape closing popups when inputs are active
-rw-r--r--src/app/js/dom_events.js6
-rw-r--r--src/app/js/gamepad.js3
2 files changed, 3 insertions, 6 deletions
diff --git a/src/app/js/dom_events.js b/src/app/js/dom_events.js
index ab79c57..490d2ec 100644
--- a/src/app/js/dom_events.js
+++ b/src/app/js/dom_events.js
@@ -26,12 +26,6 @@ document.addEventListener("drop", (e) => {
mods.install_from_path(e.dataTransfer.files[0].path);
})
-document.body.addEventListener("keyup", (e) => {
- if (e.key == "Escape") {
- popups.hide_last();
- }
-})
-
document.body.addEventListener("click", (e) => {
if (e.target.tagName.toLowerCase() === "a"
&& e.target.protocol != "file:") {
diff --git a/src/app/js/gamepad.js b/src/app/js/gamepad.js
index 134a486..1f65cbe 100644
--- a/src/app/js/gamepad.js
+++ b/src/app/js/gamepad.js
@@ -295,6 +295,9 @@ window.addEventListener("keydown", (e) => {
case "Space": return select();
case "Enter": return select();
+ // close popup
+ case "Escape": return popups.hide_last();
+
// move selection
case "KeyK": case "ArrowUp": return navigate.move("up")
case "KeyJ": case "ArrowDown": return navigate.move("down")