Skip to content

fix(ui): guard OTP Continue submissions and clean up dead slot disabled state - #11084

Merged
jescalan merged 2 commits into
mainfrom
je/fix-otp-code-control
Dec 3, 2026
Merged

jescalan merged 2 commits into
mainfrom
je/fix-otp-code-control

Conversation

@jescalan

@jescalan jescalan commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Clicking the Continue button on prebuilt OTP verification screens could burn verification attempts or clear partial input when a user clicked before entering a full code.

In useFieldOTP, onFakeContinue unconditionally called paramsOnCodeEntryFinished('', resolve, reject), sending an empty verification attempt to FAPI even when the code was empty, partial, in flight, or waiting to reset after an error. onFakeContinue now returns without submitting when a request is in flight or when all digits are already entered (auto-submit already handles complete codes), and otherwise sets a local form_param_nil (Enter code.) error on the code field without hitting FAPI.

In OTPCodeControl, this also removes an orphaned disabled state latch (useEffect setting disabled = true on any truthy feedback with no reset) along with its react-hooks/set-state-in-effect entry in packages/ui/eslint-suppressions.json, deriving OTPInputSlot's isDisabled prop directly from isDisabled || isLoading || feedbackType === 'success'. DivInput does not currently render isDisabled, so this part is dead-state cleanup rather than a visible slot-lockout fix.

To verify, run pnpm --filter @clerk/ui test src/elements/__tests__/CodeControl.test.tsx, pnpm --filter @clerk/ui lint, and pnpm --filter @clerk/ui type-check.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

✎

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Dec 3, 2026 4:31pm UTC
mosaic-docs Ready Ready Preview Dec 3, 2026 4:31pm UTC
swingset Ready Ready Preview Dec 3, 2026 4:31pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f7e29f2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The OTP Continue handler returns without submitting when a verification is in flight or all OTP slots are filled. Otherwise, it sets a “Enter code.” field error. OTP slots remain enabled after field feedback and are disabled only for isDisabled, loading, or success feedback. Tests cover field errors, incomplete codes, and duplicate submission attempts.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • clerk/javascript#11048: It changes useFieldOTP submission behavior for completed codes while another verification is in flight.

Suggested reviewers: alexcarpenter

Merge Risk: Minimal · up to f7e29

This change stops premature Continue clicks on OTP screens from submitting an empty code or clearing partial input. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: guarding OTP Continue submissions in useFieldOTP and removing the dead slot disabled state in OTPCodeControl. The raw summary and objectives confirm both parts. The ti…
Description check Passed The description explains the bug (Continue sends an empty FAPI verification attempt or clears partial input), the fix in useFieldOTP (skip while in flight or when fully entered, otherwise set a local …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: guarding OTP Continue submissions in useFieldOTP and removing the dead slot disabled state in OTPCodeControl. The raw summary and objectives confirm both parts. The title is specific and follows the conventional commit style.

Full details: Description check

Explanation

The description explains the bug (Continue sends an empty FAPI verification attempt or clears partial input), the fix in useFieldOTP (skip while in flight or when fully entered, otherwise set a local form_param_nil error), and the dead-state cleanup in OTPCodeControl with its eslint-suppressions entry. It also lists verification commands. This matches the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: This review skipped 6 repositories. Cross-repository analysis may be incomplete. Check linked repository access and settings.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c5250bb and f7e29f2.

Files selected for processing: 3

  • .changeset/fix-otp-code-control.md
  • packages/ui/eslint-suppressions.json
  • packages/ui/src/elements/__tests__/CodeControl.test.tsx
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Files with no reviewable changes: 1

  • packages/ui/eslint-suppressions.json

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

@blacksmith-sh

blacksmith-sh Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Matches Continue without a full code shows Enter code and sends nothing

Head shows 'Enter code.', keeps the partial 123 and sends no attempt. Base sent an empty code on each click and wiped the 123.

Before · Recording

Recording

Watch full video · Original footage · 0:00 Continue with empty code · 0:02 Continue with partial code

After · Recording

Recording

Watch full video · Original footage · 0:00 Continue with empty code · 0:02 Continue with partial code

Also checked · 1 match

Matches Slots still accept a new code after a wrong one

Proof on f7e29f2d (from c5250bbf) · mocked: Clerk Frontend API (MSW scenario stub otp-sign-in.ts answers sign-in and rejects every code with for...) · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-12-03T16:31:00.363Z

Summary

Metric Count
Packages analyzed 20
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on f7e29f2.

@pkg-pr-new

pkg-pr-new Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@11084

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@11084

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@11084

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@11084

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@11084

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@11084

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@11084

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@11084

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@11084

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@11084

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@11084

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@11084

@clerk/express

npm i https://pkg.pr.new/@clerk/express@11084

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@11084

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@11084

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@11084

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@11084

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@11084

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@11084

@clerk/react

npm i https://pkg.pr.new/@clerk/react@11084

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@11084

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@11084

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@11084

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@11084

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@11084

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@11084

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@11084

commit: f7e29f2

@jescalan jescalan changed the title fix(ui): keep OTP slots enabled after errors and guard Continue submissions fix(ui): guard OTP Continue submissions and clean up dead slot disabled state Dec 3, 2026
@jescalan
jescalan force-pushed the je/fix-otp-code-control branch from c5250bb to f7e29f2 Compare December 3, 2026 16:26
@jescalan
jescalan merged commit a5a2c50 into main Dec 3, 2026
65 checks passed
@jescalan
jescalan deleted the je/fix-otp-code-control branch December 3, 2026 17:42

This branch was successfully deployed

2 active deployments
Preview – swingset — f7e29f2d Deployed Dec 3, 2026 by vercel[bot]
Preview – clerk-js-sandbox — f7e29f2d Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants