Fix search input not getting focus when select2 dropdown element gets focused closes #30607

This commit is contained in:
roykho 2021-09-01 11:41:01 -07:00
parent de42581845
commit ccf481c97b
No known key found for this signature in database
GPG Key ID: 7B36C0EA25795714
1 changed files with 6 additions and 0 deletions

View File

@ -1088,6 +1088,12 @@ S2.define('select2/results',[
self.setClasses(); self.setClasses();
self.ensureHighlightVisible(); self.ensureHighlightVisible();
// NOTE: DOM's version of the object and not jQuery.
var searchField = self.$results.parents( '.select2-container' ).find( 'input.select2-search__field' )[0];
if ( 'undefined' !== typeof searchField ) {
searchField.focus();
}
}); });
container.on('close', function () { container.on('close', function () {