From b07130f3c7fc5fbab52756ed8e0f3b37cbc975a0 Mon Sep 17 00:00:00 2001 From: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:39:12 +0200 Subject: [PATCH] fix(popup/InputAmount): don't be overly restrictive in keys allowed --- src/popup/components/InputAmount.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/popup/components/InputAmount.tsx b/src/popup/components/InputAmount.tsx index 1ddf4494..6c346693 100644 --- a/src/popup/components/InputAmount.tsx +++ b/src/popup/components/InputAmount.tsx @@ -100,12 +100,9 @@ export function validateAmount( } function allowOnlyNumericInput(ev: React.KeyboardEvent) { + if (ev.key.length > 1 || ev.ctrlKey || ev.metaKey) return; if ( - (!charIsNumber(ev.key) && - ev.key !== 'Backspace' && - ev.key !== 'Delete' && - ev.key !== 'Enter' && - ev.key !== 'Tab') || + !charIsNumber(ev.key) || (ev.key === '.' && ev.currentTarget.value.includes('.')) ) { ev.preventDefault();