From 9d89600b75f4bc66049179591de8c59490fa4716 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 20 Feb 2020 17:26:25 +0100 Subject: [PATCH] Prevent keyboard event handling for drop-down menus attached to input elements --- .../files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js index 5f5594d7ee..836adb47e4 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js @@ -549,7 +549,13 @@ define( }, _handleKeyDown: function(event) { - if (EventKey.Enter(event) || (EventKey.Space(event) && event.currentTarget.nodeName !== 'INPUT')) { + // elements are not valid targets for drop-down menus. However, some developers + // might still decide to combine them, in which case we try not to break things even more. + if (event.currentTarget.nodeName === 'INPUT') { + return; + } + + if (EventKey.Enter(event) || EventKey.Space(event)) { event.preventDefault(); this._toggle(event); } -- 2.20.1