Skip to content

fix(auth): autofocus OTP input on verification step#4344

Open
monev1905 wants to merge 3 commits into
multica-ai:mainfrom
monev1905:fix/autofocus-otp-input
Open

fix(auth): autofocus OTP input on verification step#4344
monev1905 wants to merge 3 commits into
multica-ai:mainfrom
monev1905:fix/autofocus-otp-input

Conversation

@monev1905

@monev1905 monev1905 commented Jun 19, 2026

Copy link
Copy Markdown

What does this PR do?

The login email-verification step renders the OTP input without focus. On every login you have to click the field before you can type the code — small friction that's especially noticeable when switching between accounts repeatedly.

Thinking path: Multica is built for fast, repeated logins (account/workspace switching is a core flow), so the verification step is hit often. The email step's <Input> on the same page already autofocuses, and the mobile OTP component (apps/mobile/app/(auth)/verify.tsx) already passes autoFocus — the web verification step was the only login input missing it. Adding autoFocus makes the cursor land in the field as soon as the step mounts, consistent with the patterns already in the codebase.

Related Issue

No existing issue — happy to open one if you'd prefer it tracked separately.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • packages/views/auth/login-page.tsx: add autoFocus to the InputOTP on the verification (code) step.

How to Test

  1. Go to /login, enter an email, submit.
  2. On the "Check your email" step, the cursor is now in the OTP field on arrival.
  3. Type the code without clicking first.

Before: field is unfocused, a click is required. After: the field is focused on mount.

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have run tests locally and they pass (packages/views login-page.test.tsx 33/33, @multica/views typecheck clean)
  • I have added or updated tests where applicable — added a packages/views test asserting the OTP input is focused on mount of the verification step (fails if the autoFocus prop is removed)
  • If this change affects the UI, I have included before/after screenshots — it's a focus-state change (cursor in field on mount); hard to convey in a static image, happy to add a short GIF if useful
  • I have considered and documented any risks above — none beyond focus moving to the OTP field on mount
  • I will address all reviewer comments before requesting merge

AI Disclosure

AI tool used: Claude Code (Opus)

Prompt / approach: I reported the UX annoyance — the OTP field isn't focused when the verification step opens, so I have to click it every time I switch accounts. Claude located the InputOTP in packages/views/auth/login-page.tsx, confirmed that the email step on the same page and the mobile OTP component already autofocus, added the matching autoFocus prop, and ran the existing unit test + package typecheck before committing.

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

The email-verification step renders the OTP input without focus, so
users must click the field before typing the code. This is friction on
every login, especially when switching accounts.

Add `autoFocus` to the InputOTP so the cursor lands in the field as
soon as the step mounts. Mirrors the existing email-step input and the
mobile OTP component, both of which already autofocus.
@monev1905 monev1905 force-pushed the fix/autofocus-otp-input branch from 4cd2502 to 82c315d Compare June 19, 2026 14:45
Autofocusing the OTP input makes input-otp run its focus-time DOM
measurement, which calls document.elementFromPoint. jsdom doesn't
implement it, so the web login test threw an unhandled error.

packages/views/test/setup.ts already stubs this for the same reason;
mirror the stub in the web test setup (which already stubs
ResizeObserver for input-otp).
Guards the autofocus behavior: the test fails if the autoFocus prop is
removed from the verification-step InputOTP. Lives in packages/views
since it covers shared component behavior, mocking @multica/core.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant