diff --git a/src/components/MagicCodeInput.js b/src/components/MagicCodeInput.js index 5dba1c9c1b20..d6e539340274 100644 --- a/src/components/MagicCodeInput.js +++ b/src/components/MagicCodeInput.js @@ -137,9 +137,13 @@ function MagicCodeInput(props) { return; } + if (props.value.length !== props.maxLength) { + return; + } + // Focus the last input if an error occurred to allow for corrections inputRefs.current[props.maxLength - 1].focus(); - }, [props.hasError, props.maxLength]); + }, [props.hasError, props.maxLength, props.value]); useEffect(() => { validateAndSubmit(props.value);