Skip to content

Commit 00225b6

Browse files
authored
Merge pull request #1245 from zoglo/fix/shift-key-navigation
Fix `shift` key handling when navigating with `tab`
2 parents 4d82380 + d3afeba commit 00225b6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/scripts/choices.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,15 +1606,15 @@ class Choices {
16061606
event.key === 'Unidentified';
16071607

16081608
/*
1609-
We do not show the dropdown if the keycode was tab or esc
1610-
as these one are used to focusOut of e.g. select choices.
1609+
We do not show the dropdown if focusing out with esc or navigating through input fields.
16111610
An activated search can still be opened with any other key.
16121611
*/
16131612
if (
16141613
!this._isTextElement &&
16151614
!hasActiveDropdown &&
16161615
keyCode !== KeyCodeMap.ESC_KEY &&
1617-
keyCode !== KeyCodeMap.TAB_KEY
1616+
keyCode !== KeyCodeMap.TAB_KEY &&
1617+
keyCode !== KeyCodeMap.SHIFT_KEY
16181618
) {
16191619
this.showDropdown();
16201620

src/scripts/interfaces/keycode-map.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const KeyCodeMap = {
22
TAB_KEY: 9,
3+
SHIFT_KEY: 16,
34
BACK_KEY: 46,
45
DELETE_KEY: 8,
56
ENTER_KEY: 13,

0 commit comments

Comments
 (0)