Skip to content

Commit

Permalink
Update base.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrofurtado committed Sep 15, 2018
1 parent db30f66 commit 933189b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/select2/selection/base.js
Expand Up @@ -81,7 +81,9 @@ define([
self.$selection.removeAttr('aria-activedescendant');
self.$selection.removeAttr('aria-owns');

self.$selection.focus();
window.setTimeout(function () {
self.$selection.focus();
}, 0);

self._detachCloseHandler(container);
});
Expand Down

2 comments on commit 933189b

@pushkin-
Copy link

@pushkin- pushkin- commented on 933189b Apr 5, 2019

Choose a reason for hiding this comment

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

@pedrofurtado Could you explain the reason behind this commit? I'm seeing an issue where focus is triggering after the dropdown closes, which is causing the dropdown to open again. Removing the setTimeout fixes the issue for me.

I should say that I don't see this behavior when pointing to the bundled script select2.js, but I do see it when pointing to core.js, which requires the other scripts.

@jonahgreenthal
Copy link

Choose a reason for hiding this comment

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

For the record, @pedrofurtado seems to no longer be involved with Select2. He appeared for a few weeks, did a bunch of work that made things worse instead of better, then vanished.

Please sign in to comment.