File tree 1 file changed +11
-1
lines changed
Filter options
packages/core/useMagicKeys
1 file changed +11
-1
lines changed
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ export function useMagicKeys(options: UseMagicKeysOptions<boolean> = {}): any {
85
85
}
86
86
const refs : Record < string , any > = useReactive ? reactive ( obj ) : obj
87
87
const metaDeps = new Set < string > ( )
88
+ const shiftDeps = new Set < string > ( )
88
89
const usedKeys = new Set < string > ( )
89
90
90
91
function setRefs ( key : string , value : boolean ) {
@@ -119,7 +120,16 @@ export function useMagicKeys(options: UseMagicKeysOptions<boolean> = {}): any {
119
120
usedKeys . add ( key )
120
121
setRefs ( key , value )
121
122
}
122
-
123
+ if ( key === 'shift' && ! value ) {
124
+ shiftDeps . forEach ( ( key ) => {
125
+ current . delete ( key )
126
+ setRefs ( key , false )
127
+ } )
128
+ shiftDeps . clear ( )
129
+ }
130
+ else if ( typeof e . getModifierState === 'function' && e . getModifierState ( 'Shift' ) && value ) {
131
+ [ ...current , ...values ] . forEach ( key => shiftDeps . add ( key ) )
132
+ }
123
133
// #1312
124
134
// In macOS, keys won't trigger "keyup" event when Meta key is released
125
135
// We track it's combination and release manually
You can’t perform that action at this time.
0 commit comments