From 18688807122dacf5e2731dd1f572f55b423733cb Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 10 Sep 2016 17:57:23 +0200 Subject: [PATCH] Properly closing search bar on dropdown open --- wcfsetup/install/files/js/WCF.js | 5 +---- .../files/js/WoltLabSuite/Core/Ui/Page/Header/Fixed.js | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 2460648d9d..b0725e4824 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1200,10 +1200,7 @@ WCF.Dropdown.Interactive.Instance = Class.extend({ this._triggerElement.addClass('open'); this._container.addClass('open'); - var pageHeader = elById('pageHeader'); - if (pageHeader && pageHeader.classList.contains('searchBarOpen')) { - pageHeader.classList.remove('searchBarOpen'); - } + WCF.System.Event.fireEvent('com.woltlab.wcf.Search', 'close'); this.render(); }, diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Header/Fixed.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Header/Fixed.js index 85b9ff34a1..347153e188 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Header/Fixed.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Header/Fixed.js @@ -31,6 +31,8 @@ define(['Core', 'EventHandler', 'Ui/Alignment', 'Ui/CloseOverlay', 'Ui/Screen', unmatch: function () { _isMobile = false; }, setup: function () { _isMobile = true; } }); + + EventHandler.add('com.woltlab.wcf.Search', 'close', this._closeSearchBar.bind(this)); }, /** @@ -113,7 +115,7 @@ define(['Core', 'EventHandler', 'Ui/Alignment', 'Ui/CloseOverlay', 'Ui/Screen', _closeSearchBar: function () { _pageHeader.classList.remove('searchBarOpen'); - + console.debug("yep"); ['bottom', 'left', 'right', 'top'].forEach(function(propertyName) { _searchInputContainer.style.removeProperty(propertyName); }); -- 2.20.1