@@ -36,6 +36,8 @@ interface Shortcut {
36
36
37
37
const chainedShortcutRegex = / ^ [ ^ - ] + .* - .* [ ^ - ] + $ /
38
38
const combinedShortcutRegex = / ^ [ ^ _ ] + .* _ .* [ ^ _ ] + $ /
39
+ // keyboard keys which can be combined with Shift modifier (in addition to alphabet keys)
40
+ const shiftableKeys = [ 'arrowleft' , 'arrowright' , 'arrowup' , 'arrowright' , 'tab' , 'escape' , 'enter' , 'backspace' ]
39
41
40
42
export function extractShortcuts ( items : any [ ] | any [ ] [ ] ) {
41
43
const shortcuts : Record < string , Handler > = { }
@@ -76,7 +78,8 @@ export function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options: Shor
76
78
return
77
79
}
78
80
79
- const alphabeticalKey = / ^ [ a - z ] { 1 } $ / i. test ( e . key )
81
+ const alphabetKey = / ^ [ a - z ] { 1 } $ / i. test ( e . key )
82
+ const shiftableKey = shiftableKeys . includes ( e . key . toLowerCase ( ) )
80
83
81
84
let chainedKey
82
85
chainedInputs . value . push ( e . key )
@@ -109,9 +112,9 @@ export function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options: Shor
109
112
if ( e . ctrlKey !== shortcut . ctrlKey ) {
110
113
continue
111
114
}
112
- // shift modifier is only checked in combination with alphabetical keys
113
- // (shift with non-alphabetical keys would change the key)
114
- if ( alphabeticalKey && e . shiftKey !== shortcut . shiftKey ) {
115
+ // shift modifier is only checked in combination with alphabet keys and some extra keys
116
+ // (shift with special characters would change the key)
117
+ if ( ( alphabetKey || shiftableKey ) && e . shiftKey !== shortcut . shiftKey ) {
115
118
continue
116
119
}
117
120
// alt modifier changes the combined key anyways
0 commit comments