Skip to content

Commit

Permalink
FIX: more resilient focus filter or header
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed Apr 2, 2018
1 parent 017f5c1 commit d54da51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6
Expand Up @@ -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();
}
});
});
Expand Down

2 comments on commit d54da51

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/help-us-test-select-kit/74502/133

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/setup-wizard-select-bug/84333/4

Please sign in to comment.