From 78cadcebd7cfadfc4562ab9d16ca04cd4ffd05dd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 26 Aug 2016 18:03:05 +0200 Subject: [PATCH] Prevent menu close on interactive dropdown close attempt --- wcfsetup/install/files/js/WCF.js | 12 ++++++++++++ .../files/js/WoltLabSuite/Core/Ui/Page/Menu/User.js | 13 +++++++++++++ 2 files changed, 25 insertions(+) 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); + } } }); -- 2.20.1