From f459efef43b43a3de8b9424f463078da4525697d Mon Sep 17 00:00:00 2001 From: Salim Abubakar Date: Mon, 18 Nov 2024 03:18:05 +0100 Subject: [PATCH] fix: prevent OTP input focus from advancing when previous input is empty (#51664) Co-authored-by: Salim Abubakar --- components/input/OTP/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/input/OTP/index.tsx b/components/input/OTP/index.tsx index b3650641f2..7c10017778 100644 --- a/components/input/OTP/index.tsx +++ b/components/input/OTP/index.tsx @@ -208,7 +208,7 @@ const OTP = React.forwardRef((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(); }