aboutsummaryrefslogtreecommitdiff
path: root/ui/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/static/js')
-rw-r--r--ui/static/js/bootstrap.js2
-rw-r--r--ui/static/js/keyboard_handler.js14
-rw-r--r--ui/static/js/nav_handler.js5
3 files changed, 9 insertions, 12 deletions
diff --git a/ui/static/js/bootstrap.js b/ui/static/js/bootstrap.js
index 1327a221..5c0bfac9 100644
--- a/ui/static/js/bootstrap.js
+++ b/ui/static/js/bootstrap.js
@@ -29,7 +29,7 @@ document.addEventListener("DOMContentLoaded", function() {
keyboardHandler.on("f", () => navHandler.toggleBookmark());
keyboardHandler.on("?", () => navHandler.showKeyboardShortcuts());
keyboardHandler.on("#", () => navHandler.unsubscribeFromFeed());
- keyboardHandler.on("/", () => navHandler.setFocusToSearchInput());
+ keyboardHandler.on("/", (e) => navHandler.setFocusToSearchInput(e));
keyboardHandler.on("Escape", () => ModalHandler.close());
keyboardHandler.listen();
diff --git a/ui/static/js/keyboard_handler.js b/ui/static/js/keyboard_handler.js
index e30b0ddc..df6eefc9 100644
--- a/ui/static/js/keyboard_handler.js
+++ b/ui/static/js/keyboard_handler.js
@@ -21,12 +21,14 @@ class KeyboardHandler {
let keys = combination.split(" ");
if (keys.every((value, index) => value === this.queue[index])) {
- this.execute(combination, event);
+ this.queue = [];
+ this.shortcuts[combination](event);
return;
}
if (keys.length === 1 && key === keys[0]) {
- this.execute(combination, event);
+ this.queue = [];
+ this.shortcuts[combination](event);
return;
}
}
@@ -37,14 +39,6 @@ class KeyboardHandler {
};
}
- execute(combination, event) {
- event.preventDefault();
- event.stopPropagation();
-
- this.queue = [];
- this.shortcuts[combination](event);
- }
-
isEventIgnored(event) {
return event.target.tagName === "INPUT" || event.target.tagName === "TEXTAREA";
}
diff --git a/ui/static/js/nav_handler.js b/ui/static/js/nav_handler.js
index 689f206e..dd106074 100644
--- a/ui/static/js/nav_handler.js
+++ b/ui/static/js/nav_handler.js
@@ -1,5 +1,8 @@
class NavHandler {
- setFocusToSearchInput() {
+ setFocusToSearchInput(event) {
+ event.preventDefault();
+ event.stopPropagation();
+
let toggleSwitchElement = document.querySelector(".search-toggle-switch");
if (toggleSwitchElement) {
toggleSwitchElement.style.display = "none";