From: Alexander Ebert Date: Thu, 20 Aug 2020 22:28:22 +0000 (+0200) Subject: Prevent the focus being trapped if the user intentionally clicks outside X-Git-Tag: 5.2.9~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6bac4a238f942d596b662299b37d9eb214ea7ce8;p=GitHub%2FWoltLab%2FWCF.git Prevent the focus being trapped if the user intentionally clicks outside Clicking on a link or button outside of the overlay caused the browser to close the drop-down and shift the focus on the menu element. --- diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index 975554177a..2b5a12225f 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -455,6 +455,11 @@ if (COMPILER_TARGET_DEFAULT) { * @param {Event} event */ _maintainFocus: function(event) { + // Ignore a focus shift that was not the result of a keyboard interaction. + if (document.activeElement && !document.activeElement.classList.contains('focus-visible')) { + return; + } + var dropdown = this._dropdown.getContainer()[0]; if (!dropdown.contains(event.target)) {