FIX: makes typing indicator visible when possible

This commit is contained in:
Joffrey JAFFEUX 2017-11-21 18:07:10 +01:00 committed by GitHub
parent 3dfc0777df
commit 9444c31918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -63,6 +63,9 @@ export default SelectKitComponent.extend({
return this._super() && !computedValues.includes(filter); return this._super() && !computedValues.includes(filter);
}, },
@computed
shouldDisplayFilter() { return true; },
_beforeWillComputeValues(values) { _beforeWillComputeValues(values) {
return values.map(v => this._castInteger(v === "" ? null : v)); return values.map(v => this._castInteger(v === "" ? null : v));
}, },

View File

@ -55,12 +55,6 @@ export default Ember.Mixin.create({
$(`.select-kit-fixed-placeholder-${this.elementId}`).remove(); $(`.select-kit-fixed-placeholder-${this.elementId}`).remove();
}, },
// make sure we don’t propagate a click outside component
// to avoid closing a modal containing the component for example
click(event) {
this._destroyEvent(event);
},
// use to collapse and remove focus // use to collapse and remove focus
close(event) { close(event) {
this.collapse(event); this.collapse(event);
@ -69,7 +63,13 @@ export default Ember.Mixin.create({
// force the component in a known default state // force the component in a known default state
focus() { focus() {
Ember.run.schedule("afterRender", () => this.$header().focus() ); Ember.run.schedule("afterRender", () => {
if (this.$filterInput().is(":visible")) {
this.$filterInput().focus();
} else {
this.$header().focus();
}
});
}, },
expand(event) { expand(event) {

View File

@ -193,6 +193,12 @@ export default Ember.Mixin.create({
return; return;
}, },
// make sure we don’t propagate a click outside component
// to avoid closing a modal containing the component for example
click(event) {
this._destroyEvent(event);
},
tabFromHeader(event) { this.didPressTab(event); }, tabFromHeader(event) { this.didPressTab(event); },
tabFromFilter(event) { this.didPressTab(event); }, tabFromFilter(event) { this.didPressTab(event); },