FIX: more resilient focus filter or header

This commit is contained in:
Joffrey JAFFEUX 2018-04-02 22:50:20 +02:00 committed by GitHub
parent 017f5c1aee
commit d54da517d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,13 +67,14 @@ export default Ember.Mixin.create({
// try to focus filter and fallback to header if not present // try to focus filter and fallback to header if not present
focusFilterOrHeader() { focusFilterOrHeader() {
const context = this;
// 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 (!this.$filterInput().is(":visible")) { if (!context.$filterInput() || !context.$filterInput().is(":visible")) {
this.$header().focus(); context.$header().focus();
} else { } else {
this.$filterInput().focus(); context.$filterInput().focus();
} }
}); });
}); });