A platform for community discussion. Free, open, simple.
FIX: fires onExpand/onCollapse when using arrows
Joffrey JAFFEUXcbbeedf53b2a
diff --git a/app/assets/javascripts/select-kit/components/select-kit.js.es6 b/app/assets/javascripts/select-kit/components/select-kit.js.es6index 895fbddfc70..9054fa50fc8 100644--- a/app/assets/javascripts/select-kit/components/select-kit.js.es6+++ b/app/assets/javascripts/select-kit/components/select-kit.js.es6@@ -359,10 +359,8 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixithis.clearHighlightSelection();if (this.get("isExpanded")) {- this._boundaryActionHandler("onCollapse", this);this.collapse();} else {- this._boundaryActionHandler("onExpand", this);this.expand();}},diff --git a/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6 b/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6index 206e5fb7701..2330daa4dc1 100644--- a/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6+++ b/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6@@ -84,11 +84,13 @@ export default Ember.Mixin.create({this.setProperties({ isExpanded: true, renderedBodyOnce: true, isFocused: true });this.focusFilterOrHeader();this.autoHighlight();+ this._boundaryActionHandler("onExpand", this);},collapse() {this.set("isExpanded", false);Ember.run.schedule("afterRender", () => this._removeFixedPosition() );+ this._boundaryActionHandler("onCollapse", this);},// lose focus of the component in two stepsdiff --git a/app/assets/javascripts/select-kit/mixins/events.js.es6 b/app/assets/javascripts/select-kit/mixins/events.js.es6index 25e30e87c59..2d87e9c9f0b 100644--- a/app/assets/javascripts/select-kit/mixins/events.js.es6+++ b/app/assets/javascripts/select-kit/mixins/events.js.es6@@ -193,9 +193,7 @@ export default Ember.Mixin.create({const keyCode = event.keyCode || event.which;- const $rows = this.$rows();-- if (this.get("isExpanded") === false) {+ if (!this.get("isExpanded")) {this.expand(event);if (this.$selectedRow().length === 1) {@@ -206,6 +204,8 @@ export default Ember.Mixin.create({return;}+ const $rows = this.$rows();+if (!$rows.length) { return; }if ($rows.length === 1) {