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
1 changed files with 4 additions and 3 deletions

View File

@ -67,13 +67,14 @@ export default Ember.Mixin.create({
// try to focus filter and fallback to header if not present
focusFilterOrHeader() {
const context = this;
// next so we are sure it finised expand/collapse
Ember.run.next(() => {
Ember.run.schedule("afterRender", () => {
if (!this.$filterInput().is(":visible")) {
this.$header().focus();
if (!context.$filterInput() || !context.$filterInput().is(":visible")) {
context.$header().focus();
} else {
this.$filterInput().focus();
context.$filterInput().focus();
}
});
});