diff --git a/app/assets/javascripts/discourse/controllers/header.js.es6 b/app/assets/javascripts/discourse/controllers/header.js.es6 index f81ec83cdd2..813e9e717ec 100644 --- a/app/assets/javascripts/discourse/controllers/header.js.es6 +++ b/app/assets/javascripts/discourse/controllers/header.js.es6 @@ -18,6 +18,11 @@ const HeaderController = Ember.Controller.extend({ actions: { + toggleMenuPanel(visibleProp) { + this.toggleProperty(visibleProp); + this.appEvents.trigger('dropdowns:closeAll'); + }, + toggleStar() { const topic = this.get('topic'); if (topic) topic.toggleStar(); diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 index 221fac0ff5d..26f716c1f30 100644 --- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 +++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 @@ -65,6 +65,7 @@ export default { this.searchService = this.container.lookup('search-service:main'); + this.appEvents = this.container.lookup('app-events:main'); _.each(PATH_BINDINGS, this._bindToPath, this); _.each(CLICK_BINDINGS, this._bindToClick, this); @@ -169,15 +170,15 @@ export default { }, showSearch() { - this.container.lookup('controller:header').toggleProperty('searchVisible'); + this.container.lookup('controller:header').send('toggleMenuPanel', 'searchVisible'); }, toggleHamburgerMenu() { - this.container.lookup('controller:header').toggleProperty('hamburgerVisible'); + this.container.lookup('controller:header').send('toggleMenuPanel', 'hamburgerVisible'); }, showCurrentUser() { - this.container.lookup('controller:header').toggleProperty('userMenuVisible'); + this.container.lookup('controller:header').send('toggleMenuPanel', 'userMenuVisible'); }, showHelpModal() {