From fd800b544f30c8feb7d927d7023094b8adde6d28 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 20 Jun 2016 10:12:01 +0800 Subject: [PATCH] FIX: Hide popup-menu options when typing. --- .../javascripts/discourse/components/popup-menu.js.es6 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/javascripts/discourse/components/popup-menu.js.es6 b/app/assets/javascripts/discourse/components/popup-menu.js.es6 index 9be0b8f3e..4f8de9b59 100644 --- a/app/assets/javascripts/discourse/components/popup-menu.js.es6 +++ b/app/assets/javascripts/discourse/components/popup-menu.js.es6 @@ -7,6 +7,10 @@ export default Ember.Component.extend({ _setup() { this.appEvents.on("popup-menu:open", this, "_changeLocation"); + $('html').on(`keydown.popup-menu-${this.get('elementId')}`, () => { + this.sendAction('hide'); + }); + $('html').on(`mouseup.popup-menu-${this.get('elementId')}`, (e) => { const $target = $(e.target); if ($target.is("button") || this.$().has($target).length === 0) { @@ -18,6 +22,7 @@ export default Ember.Component.extend({ @on('willDestroyElement') _cleanup() { $('html').off(`mouseup.popup-menu-${this.get('elementId')}`); + $('html').off(`keydown.popup-menu-${this.get('elementId')}`); this.appEvents.off("popup-menu:open", this, "_changeLocation"); },