aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/static/js
diff options
context:
space:
mode:
authorGravatar Diego Agulló <diego.agullo@mo2o.com>2018-10-31 13:59:02 +0100
committerGravatar Diego Agulló <diego.agullo@mo2o.com>2018-10-31 13:59:02 +0100
commita70e9d03ffdc876446d39f25b331ba4db914d10d (patch)
treed24324f725194cd80e74c13e4205eb79bed36b72 /ui/static/js
parentae1dc1a91eea23be14f952efb130412fe6a7996b (diff)
Ignore hotkeys containing Control, Alt or Meta keys
Fixes #260
Diffstat (limited to 'ui/static/js')
-rw-r--r--ui/static/js/keyboard_handler.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/static/js/keyboard_handler.js b/ui/static/js/keyboard_handler.js
index df6eefc..bc5708c 100644
--- a/ui/static/js/keyboard_handler.js
+++ b/ui/static/js/keyboard_handler.js
@@ -10,7 +10,7 @@ class KeyboardHandler {
listen() {
document.onkeydown = (event) => {
- if (this.isEventIgnored(event)) {
+ if (this.isEventIgnored(event) || this.isModifierKeyDown(event)) {
return;
}
@@ -43,6 +43,10 @@ class KeyboardHandler {
return event.target.tagName === "INPUT" || event.target.tagName === "TEXTAREA";
}
+ isModifierKeyDown(event) {
+ return event.getModifierState("Control") || event.getModifierState("Alt") || event.getModifierState("Meta");
+ }
+
getKey(event) {
const mapping = {
'Esc': 'Escape',
@@ -60,4 +64,5 @@ class KeyboardHandler {
return event.key;
}
+
}