mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 19:49:59 +08:00
fix: prevent OTP input focus from advancing when previous input is empty (#51664)
Co-authored-by: Salim Abubakar <salimabubakar@Salims-MacBook-Air.local>
This commit is contained in:
parent
f474bf18d8
commit
f459efef43
@ -208,7 +208,7 @@ const OTP = React.forwardRef<OTPRef, OTPProps>((props, ref) => {
|
||||
const nextCells = patchValue(index, txt);
|
||||
|
||||
const nextIndex = Math.min(index + txt.length, length - 1);
|
||||
if (nextIndex !== index) {
|
||||
if (nextIndex !== index && nextCells[index] !== undefined) {
|
||||
refs.current[nextIndex]?.focus();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user