Properly closing search bar on dropdown open
authorAlexander Ebert <ebert@woltlab.com>
Sat, 10 Sep 2016 15:57:23 +0000 (17:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 10 Sep 2016 15:57:23 +0000 (17:57 +0200)
wcfsetup/install/files/js/WCF.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Header/Fixed.js

index 2460648d9deb148d054b2323a38f5939ab0f4c66..b0725e4824d0b7706aa77d35d39c4033afde48d9 100755 (executable)
@@ -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();
        },
index 85b9ff34a135ea22fad4e0eff72e3cf650da26a6..347153e188677e87825d1491dc53a6319ce757e1 100644 (file)
@@ -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);
                        });