Skip to content

Commit 38fb876

Browse files
committed
Fix select2 first focus
1 parent 0f1f05f commit 38fb876

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/resources/views/crud/form_content.blade.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,9 @@ function triggerFocusOnFirstInputField(firstField) {
8181
*/
8282
function handleFocusOnSelect2Field(firstField){
8383
$('.select2-search__field').remove();
84-
firstField.select2('open');
84+
firstField.select2('focus');
8585
}
8686
87-
/*
88-
* Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection"
89-
* see: https://github.com/select2/select2/issues/5993
90-
* see: https://github.com/jquery/jquery/issues/4382
91-
*
92-
*/
93-
$(document).on('select2:open', () => {
94-
document.querySelector('.select2-search__field').focus();
95-
});
96-
9787
jQuery('document').ready(function($){
9888
9989
// trigger the javascript for all fields that have their js defined in a separate method

0 commit comments

Comments
 (0)