Skip to content

Commit 816af44

Browse files
committed
fix cursor position in select when opened with a char key press. fixes select2#323
1 parent 4f6bf6c commit 816af44

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

select2.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,8 @@
15151515
keyWritten = keyWritten.toUpperCase();
15161516
}
15171517

1518+
// focus the field before calling val so the cursor ends up after the value instead of before
1519+
this.search.focus();
15181520
this.search.val(keyWritten);
15191521

15201522
// prevent event propagation so it doesnt replay on the now focussed search field and result in double key entry

0 commit comments

Comments
 (0)