Skip to content

A platform for community discussion. Free, open, simple.

FIX: popup-menu instantly closing (#6147)

Joffrey JAFFEUX73d736c8c31b
diff --git a/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6 b/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6
index 69390170945..770162e88ed 100644
--- a/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6
+++ b/app/assets/javascripts/select-kit/components/toolbar-popup-menu-options.js.es6
@@ -31,19 +31,7 @@ export default DropdownSelectBoxComponent.extend({
.filter(contentItem => contentItem);
},
- didInsertElement() {
- this._super();
-
- $("#reply-control").on("touchstart.toolbar-popup-menu-options", event => {
- if (this.get("isExpanded") && !this.element.contains(event.target)) {
- this.close(event);
- }
- });
- },
-
- willDestroyElement() {
- this._super();
-
- $("#reply-control").off("touchstart.toolbar-popup-menu-options");
- }
+ // composer is triggering a focus on textarea, we avoid instantly closing
+ // popup menu by tweaking the focus out behavior
+ onFilterInputFocusout() {}
});
diff --git a/app/assets/javascripts/select-kit/mixins/events.js.es6 b/app/assets/javascripts/select-kit/mixins/events.js.es6
index 3de11e017ad..508600d1fbc 100644
--- a/app/assets/javascripts/select-kit/mixins/events.js.es6
+++ b/app/assets/javascripts/select-kit/mixins/events.js.es6
@@ -122,9 +122,7 @@ export default Ember.Mixin.create({
event.stopPropagation();
})
.on("focusout.select-kit", event => {
- if (!Ember.$.contains(this.element, event.relatedTarget)) {
- this.close(event);
- }
+ this.onFilterInputFocusout(event);
})
.on("keydown.select-kit", event => {
const keyCode = event.keyCode || event.which;
@@ -371,6 +369,12 @@ export default Ember.Mixin.create({
this.didPressEnter(event);
},
+ onFilterInputFocusout(event) {
+ if (!Ember.$.contains(this.element, event.relatedTarget)) {
+ this.close(event);
+ }
+ },
+
_moveHighlight(direction, $rows) {
const currentIndex = $rows.index(this.$highlightedRow());
let nextIndex = currentIndex + direction;