Skip to content

Commit fc4bbbb

Browse files
committed
Merge pull request select2#1846 from tpruvot/master
issue select2#1778: prevent delayed focus when the list is hidden
2 parents 261dad0 + b757fb9 commit fc4bbbb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

select2.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,9 @@ the specific language governing permissions and limitations under the Apache Lic
19921992
// without this the search field loses focus which is annoying
19931993
if (document.activeElement === this.body().get(0)) {
19941994
window.setTimeout(this.bind(function() {
1995-
this.search.focus();
1995+
if (this.opened()) {
1996+
this.search.focus();
1997+
}
19961998
}), 0);
19971999
}
19982000
}));

0 commit comments

Comments
 (0)