From 0bc9ec3b534a6ba2b82adda155eef4ad6a228eb3 Mon Sep 17 00:00:00 2001 From: Melloware Date: Sun, 24 Jul 2022 07:51:07 -0400 Subject: [PATCH] Fix #3100: KeyFilter test using e.key (#3101) --- components/lib/keyfilter/KeyFilter.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/lib/keyfilter/KeyFilter.js b/components/lib/keyfilter/KeyFilter.js index fe4b7531df..78f65aff20 100644 --- a/components/lib/keyfilter/KeyFilter.js +++ b/components/lib/keyfilter/KeyFilter.js @@ -68,13 +68,11 @@ export const KeyFilter = { return; } - const regex = this.getRegex(keyfilter); - const browser = DomHandler.getBrowser(); - if (e.ctrlKey || e.altKey) { return; } + const browser = DomHandler.getBrowser(); const k = this.getKey(e); if (browser.mozilla && (this.isNavKeyPress(e) || k === KeyFilter.KEYS.BACKSPACE || (k === KeyFilter.KEYS.DELETE && e.charCode === 0))) { return; @@ -87,7 +85,8 @@ export const KeyFilter = { return; } - if (!regex.test(cc)) { + const regex = this.getRegex(keyfilter); + if (!regex.test(e.key)) { e.preventDefault(); } },