From 02a06cae8f4979838c1d3130cf984c6d39d7762d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=BCnter?= Date: Tue, 9 Nov 2021 05:45:57 +0100 Subject: [PATCH] LinkHints/Hotkey: Unify activation (#5108) Use hotkey activation logic also for link hints. Previously it was possble to activate link hints on some input fields (e.g. search on stage page). This is now fixed. Co-authored-by: Lars Hvam --- src/ui/zabapgit_js_common.w3mi.data.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ui/zabapgit_js_common.w3mi.data.js b/src/ui/zabapgit_js_common.w3mi.data.js index 580f73aa5..981c4cf53 100644 --- a/src/ui/zabapgit_js_common.w3mi.data.js +++ b/src/ui/zabapgit_js_common.w3mi.data.js @@ -1393,11 +1393,7 @@ LinkHints.prototype.handleKey = function(event){ return; } - var activeElement = (document.activeElement && document.activeElement) || {}; - - // link hints are disabled for input and textareas for obvious reasons. - // Maybe we must add other types here in the future - if (event.key === this.linkHintHotKey && activeElement.type !== "text" && activeElement.type !== "number" && activeElement.nodeName !== "TEXTAREA") { + if (event.key === this.linkHintHotKey && Hotkeys.isHotkeyCallPossible()) { // on user hide hints, close an opened dropdown too if (this.areHintsDisplayed && this.activatedDropdown) this.closeActivatedDropdown(); @@ -1626,7 +1622,7 @@ Hotkeys.prototype.onkeydown = function(oEvent){ return; } - if (!this.isHotkeyCallPossible()){ + if (!Hotkeys.isHotkeyCallPossible()){ return; } @@ -1639,7 +1635,7 @@ Hotkeys.prototype.onkeydown = function(oEvent){ } }; -Hotkeys.prototype.isHotkeyCallPossible = function(){ +Hotkeys.isHotkeyCallPossible = function(){ var activeElementType = ((document.activeElement && document.activeElement.nodeName) || ""); var activeElementReadOnly = ((document.activeElement && document.activeElement.readOnly) || false);