From: Alexander Ebert Date: Fri, 26 Aug 2016 16:03:05 +0000 (+0200) Subject: Prevent menu close on interactive dropdown close attempt X-Git-Tag: 3.0.0_Beta_1~466 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=78cadcebd7cfadfc4562ab9d16ca04cd4ffd05dd;p=GitHub%2FWoltLab%2FWCF.git Prevent menu close on interactive dropdown close attempt --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index d4f318b170..c55cfd294e 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1065,6 +1065,18 @@ WCF.Dropdown.Interactive.Handler = { this._dropdownMenus[instance].close(); } } + }, + + getOpenDropdown: function () { + for (var instance in this._dropdownMenus) { + if (this._dropdownMenus.hasOwnProperty(instance)) { + if (this._dropdownMenus[instance].isOpen()) { + return this._dropdownMenus[instance]; + } + } + } + + return null; } }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/User.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/User.js index bfe10c28aa..068938786e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/User.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/User.js @@ -46,6 +46,19 @@ define(['Core', 'EventHandler', './Abstract'], function(Core, EventHandler, UiPa } }).bind(this)); }).bind(this)); + }, + + close: function (event) { + var dropdown = WCF.Dropdown.Interactive.Handler.getOpenDropdown(); + if (dropdown) { + event.preventDefault(); + event.stopPropagation(); + + dropdown.close(); + } + else { + UiPageMenuUser._super.prototype.close.call(this, event); + } } });