Skip to content

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

FIX: makes sure mousedown is stopped only on select-kit element

Joffrey JAFFEUXbd5a82cfe706
diff --git a/app/assets/javascripts/select-kit/mixins/events.js.es6 b/app/assets/javascripts/select-kit/mixins/events.js.es6
index 9dd501cafbd..87d4df25610 100644
--- a/app/assets/javascripts/select-kit/mixins/events.js.es6
+++ b/app/assets/javascripts/select-kit/mixins/events.js.es6
@@ -38,14 +38,19 @@ export default Ember.Mixin.create({
$(document)
.on("mousedown.select-kit", event => {
- event.stopPropagation();
+ if (!this.element || this.isDestroying || this.isDestroyed) {
+ return true;
+ }
- if (!this.get("renderedBodyOnce")) return;
- if (!this.get("isFocused")) return;
- if (Ember.isNone(this.get("element"))) return;
- if (Ember.$.contains(this.get("element"), event.target)) return;
+ if (Ember.$.contains(this.element, event.target)) {
+ event.stopPropagation();
+ if (!this.get("renderedBodyOnce")) return;
+ if (!this.get("isFocused")) return;
+ } else {
+ this.didClickOutside(event);
+ }
- this.didClickOutside(event);
+ return true;
});
this.$header()