Skip to content

Commit ce4461a

Browse files
committed
fix: incorrect modifier detection (#512)
1 parent 19770f5 commit ce4461a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,14 @@ function dispatch(event, element) {
266266
/**
267267
* -------------------------------
268268
*/
269-
270269
if (key in _mods) {
271270
_mods[key] = true;
272-
273271
// 将特殊字符的key注册到 hotkeys 上
274272
for (const k in _modifier) {
275-
if (_modifier[k] === key) hotkeys[k] = true;
273+
if (Object.prototype.hasOwnProperty.call(_modifier, k)) {
274+
const eventKey = modifierMap[_modifier[k]];
275+
hotkeys[k] = event[eventKey];
276+
}
276277
}
277278

278279
if (!asterisk) return;

0 commit comments

Comments
 (0)