From b32cf8f80d6f0e36c157abc4f62d4905c15d2421 Mon Sep 17 00:00:00 2001 From: navedqb <109583873+navedqb@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:02:58 +0530 Subject: [PATCH] fix inputotp integer-only accepting space --- components/lib/inputotp/InputOtp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/inputotp/InputOtp.js b/components/lib/inputotp/InputOtp.js index 3993e6002c..56161a314e 100644 --- a/components/lib/inputotp/InputOtp.js +++ b/components/lib/inputotp/InputOtp.js @@ -171,7 +171,7 @@ export const InputOtp = React.memo( default: { //Prevent non-numeric characters from being entered if integerOnly is true or if the length of the input is greater than the specified length - if ((props?.integerOnly && !(Number(event.key) >= 0 && Number(event.key) <= 9)) || (tokens.join('').length >= props.length && event.code !== 'Delete')) { + if ((props?.integerOnly && !(event.code !== 'Space' && Number(event.key) >= 0 && Number(event.key) <= 9)) || (tokens.join('').length >= props.length && event.code !== 'Delete')) { event.preventDefault(); }