Update select2.full.js to use trigger('focus') instead of focus() for jQuery 3 compat

This commit is contained in:
Jonathan Sadowski 2021-03-04 12:11:36 -06:00
parent c9b1012095
commit a09e82e4b6
1 changed files with 7 additions and 7 deletions

View File

@ -1430,7 +1430,7 @@ S2.define('select2/selection/base',[
// This needs to be delayed as the active element is the body when the
// key is pressed.
window.setTimeout(function () {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}, 1);
self._detachCloseHandler(container);
@ -1591,7 +1591,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
self.$selection.trigger( 'focus' );
}
});
@ -2109,7 +2109,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
this.$search.focus();
this.$search.trigger( 'focus' );
}
};
@ -3800,7 +3800,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
this.$search.trigger( 'focus' );
}
params.term = tokenData.term;
@ -4047,10 +4047,10 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.attr('aria-owns', resultsId);
self.$search.focus();
self.$search.trigger( 'focus' );
window.setTimeout(function () {
self.$search.focus();
self.$search.trigger( 'focus' );
}, 0);
});
@ -4063,7 +4063,7 @@ S2.define('select2/dropdown/search',[
container.on('focus', function () {
if (!container.isOpen()) {
self.$search.focus();
self.$search.trigger( 'focus' );
}
});