If jQuery 3.6.0 is causing this you can use this:
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});
If jQuery 3.6.0 is causing this you can use this:
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});