From 6be28b4fb5df366ac5aec89121130f03c8d37401 Mon Sep 17 00:00:00 2001 From: ramirez Date: Thu, 5 Mar 2026 18:31:19 +0900 Subject: [PATCH] fix: OTP auto-submit not firing when typing manually String.includes("") always returns true in JavaScript, so the condition `!newValue.includes("")` was always false, preventing onComplete from ever firing on manual input. Only paste worked because it uses a separate code path. The length check alone is sufficient since empty digits produce a shorter joined string. Co-Authored-By: Claude Opus 4.6 --- apps/portal/src/components/molecules/OtpInput/OtpInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/portal/src/components/molecules/OtpInput/OtpInput.tsx b/apps/portal/src/components/molecules/OtpInput/OtpInput.tsx index 8cef35a8..a57cc60d 100644 --- a/apps/portal/src/components/molecules/OtpInput/OtpInput.tsx +++ b/apps/portal/src/components/molecules/OtpInput/OtpInput.tsx @@ -65,7 +65,7 @@ function useOtpHandlers({ const newValue = newDigits.join(""); onChange(newValue); if (char && index < length - 1) focusInput(index + 1); - if (newValue.length === length && !newValue.includes("")) onComplete?.(newValue); + if (newValue.length === length) onComplete?.(newValue); }, [digits, length, onChange, onComplete, focusInput] );