Skip to content

Commit

Permalink
Merge pull request #1245 from zoglo/fix/shift-key-navigation
Browse files Browse the repository at this point in the history
Fix `shift` key handling when navigating with `tab`
  • Loading branch information
Xon authored Dec 22, 2024
2 parents 4d82380 + d3afeba commit 00225b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scripts/choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1606,15 +1606,15 @@ class Choices {
event.key === 'Unidentified';

/*
We do not show the dropdown if the keycode was tab or esc
as these one are used to focusOut of e.g. select choices.
We do not show the dropdown if focusing out with esc or navigating through input fields.
An activated search can still be opened with any other key.
*/
if (
!this._isTextElement &&
!hasActiveDropdown &&
keyCode !== KeyCodeMap.ESC_KEY &&
keyCode !== KeyCodeMap.TAB_KEY
keyCode !== KeyCodeMap.TAB_KEY &&
keyCode !== KeyCodeMap.SHIFT_KEY
) {
this.showDropdown();

Expand Down
1 change: 1 addition & 0 deletions src/scripts/interfaces/keycode-map.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const KeyCodeMap = {
TAB_KEY: 9,
SHIFT_KEY: 16,
BACK_KEY: 46,
DELETE_KEY: 8,
ENTER_KEY: 13,
Expand Down

0 comments on commit 00225b6

Please sign in to comment.