From: Alexander Ebert Date: Thu, 20 Feb 2020 16:26:25 +0000 (+0100) Subject: Prevent keyboard event handling for drop-down menus attached to input elements X-Git-Tag: 5.2.3~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9d89600b75f4bc66049179591de8c59490fa4716;p=GitHub%2FWoltLab%2FWCF.git Prevent keyboard event handling for drop-down menus attached to input elements --- 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); }