FIX: popup-menu instantly closing (#6147)

This commit is contained in:
Joffrey JAFFEUX 2018-07-23 14:19:36 -04:00 committed by GitHub
parent 78419f677d
commit 73d736c8c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 18 deletions

View File

@ -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() {}
});

View File

@ -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;