mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:10:17 +08:00
FIX: popup-menu instantly closing (#6147)
This commit is contained in:
parent
78419f677d
commit
73d736c8c3
|
@ -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() {}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user