FIX: various select-kit corrections on mobile

This commit is contained in:
Joffrey JAFFEUX 2018-07-20 14:46:25 -04:00 committed by GitHub
parent 3fdc4f2df1
commit 78a2324c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 26 deletions

View File

@ -92,17 +92,6 @@ export default Ember.Component.extend(
this.set("computedContent", []); this.set("computedContent", []);
this.set("highlightedSelection", []); this.set("highlightedSelection", []);
if (this.site && this.site.isMobileDevice) {
this.setProperties({
filterable: isNone(this.get("filterable"))
? false
: this.get("filterable"),
autoFilterable: isNone(this.get("autoFilterable"))
? false
: this.get("filterable")
});
}
if (this.get("nameChanges")) { if (this.get("nameChanges")) {
this.addObserver( this.addObserver(
`content.@each.${this.get("nameProperty")}`, `content.@each.${this.get("nameProperty")}`,

View File

@ -82,8 +82,10 @@ export default Ember.Mixin.create({
}, },
focus() { focus() {
Ember.run.schedule("afterRender", () => { Ember.run.next(() => {
this.$header().focus(); Ember.run.schedule("afterRender", () => {
this.$filterInput().focus();
});
}); });
}, },
@ -93,11 +95,7 @@ export default Ember.Mixin.create({
// next so we are sure it finised expand/collapse // next so we are sure it finised expand/collapse
Ember.run.next(() => { Ember.run.next(() => {
Ember.run.schedule("afterRender", () => { Ember.run.schedule("afterRender", () => {
if ( if (!context.$filterInput() || !context.$filterInput().is(":visible")) {
(this.site && this.site.isMobileDevice) ||
!context.$filterInput() ||
!context.$filterInput().is(":visible")
) {
context.$header().focus(); context.$header().focus();
} else { } else {
context.$filterInput().focus(); context.$filterInput().focus();

View File

@ -16,11 +16,11 @@ export default Ember.Mixin.create({
}, },
willDestroyElement() { willDestroyElement() {
this._super(); this._super(...arguments);
$(document).off("mousedown.select-kit"); $(document).off("mousedown.select-kit");
if (this.$header()) { if (this.$header().length) {
this.$header() this.$header()
.off("blur.select-kit") .off("blur.select-kit")
.off("focus.select-kit") .off("focus.select-kit")
@ -28,7 +28,7 @@ export default Ember.Mixin.create({
.off("keydown.select-kit"); .off("keydown.select-kit");
} }
if (this.$filterInput()) { if (this.$filterInput().length) {
this.$filterInput() this.$filterInput()
.off("change.select-kit") .off("change.select-kit")
.off("keydown.select-kit") .off("keydown.select-kit")
@ -37,7 +37,7 @@ export default Ember.Mixin.create({
}, },
didInsertElement() { didInsertElement() {
this._super(); this._super(...arguments);
$(document).on("mousedown.select-kit", event => { $(document).on("mousedown.select-kit", event => {
if (!this.element || this.isDestroying || this.isDestroyed) { if (!this.element || this.isDestroying || this.isDestroyed) {

View File

@ -64,9 +64,9 @@
} }
.choices { .choices {
margin: 0; margin: 1px;
box-sizing: border-box; box-sizing: border-box;
display: inline-flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
flex-wrap: wrap; flex-wrap: wrap;
@ -79,7 +79,7 @@
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
flex-direction: row; flex-direction: row;
margin: 2px; margin: 1px;
} }
.filter { .filter {

View File

@ -2,7 +2,7 @@
&.dropdown-select-box { &.dropdown-select-box {
.select-kit-collection { .select-kit-collection {
max-height: 200px; max-height: 200px;
overflow-y: scroll; overflow-y: auto;
} }
} }
} }