diff --git a/components/lib/inputotp/InputOtp.js b/components/lib/inputotp/InputOtp.js index cd32c8eebf..0c2104caa6 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 && !((event.code.startsWith('Digit') || event.code.startsWith('Numpad')) && Number(event.key) >= 0 && Number(event.key) <= 9)) || (tokens.join('').length >= props.length && event.code !== 'Delete')) { + if ((props?.integerOnly && !(Number(event.key) >= 0 && Number(event.key) <= 9)) || (tokens.join('').length >= props.length && event.code !== 'Delete')) { event.preventDefault(); } @@ -217,7 +217,14 @@ export const InputOtp = React.memo( }, ptm('input') ); - const inputElement = props?.inputTemplate ? ObjectUtils.getJSXElement(props?.inputTemplate, { events: inputElementEvents, props: inputElementProps }) : ; + const inputElement = props?.inputTemplate ? ( + ObjectUtils.getJSXElement(props?.inputTemplate, { + events: inputElementEvents, + props: inputElementProps + }) + ) : ( + + ); const inputElements = [inputElement, ...createInputElements(remainingInputs - 1)]; return inputElements;