From 228952fb90a743df07a10a239db42a74e6a05451 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 17 Jul 2016 18:21:12 +0200 Subject: [PATCH] Added work-around for page action re-creating dropdown parent --- .../files/js/WoltLab/WCF/Ui/Dropdown/Simple.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dropdown/Simple.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dropdown/Simple.js index 6adad84ff7..91d08a296a 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dropdown/Simple.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dropdown/Simple.js @@ -358,6 +358,23 @@ define( var dropdown = _dropdowns.get(targetId), preventToggle = false; if (dropdown !== undefined) { + // check if the dropdown is still the same, as some components (e.g. page actions) + // re-create the parent of a button + if (event) { + var button = event.currentTarget, parent = button.parentNode; + if (parent !== dropdown) { + parent.classList.add('dropdown'); + parent.id = dropdown.id; + + // remove dropdown class and id from old parent + dropdown.classList.remove('dropdown'); + dropdown.id = ''; + + dropdown = parent; + _dropdowns.set(targetId, parent); + } + } + // Repeated clicks on the dropdown button will not cause it to close, the only way // to close it is by clicking somewhere else in the document or on another dropdown // toggle. This is used with the search bar to prevent the dropdown from closing by -- 2.20.1