Skip to content

Commit db5b908

Browse files
committed
chore: adjust
1 parent 91c7769 commit db5b908

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/KeyCode.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,24 +520,33 @@ const KeyCode = {
520520

521521
shouldIgnoreKeyboardEvent: function shouldIgnoreKeyboardEvent(
522522
e: KeyboardEvent,
523+
options?: {
524+
checkEditable?: boolean;
525+
checkComposing?: boolean;
526+
},
523527
) {
524528
const target = e.target;
529+
const { checkEditable = true, checkComposing = true } = options || {};
525530

526531
if (!(target instanceof HTMLElement)) {
527532
return false;
528533
}
529534

530535
const tagName = target.tagName;
531536
if (
532-
e.isComposing ||
533-
tagName === 'INPUT' ||
534-
tagName === 'TEXTAREA' ||
535-
tagName === 'SELECT' ||
536-
target.isContentEditable
537+
checkEditable &&
538+
(tagName === 'INPUT' ||
539+
tagName === 'TEXTAREA' ||
540+
tagName === 'SELECT' ||
541+
target.isContentEditable)
537542
) {
538543
return true;
539544
}
540545

546+
if (checkComposing && e.isComposing) {
547+
return true;
548+
}
549+
541550
return false;
542551
},
543552
};

0 commit comments

Comments
 (0)