Skip to content

fix(input-otp): enforce LTR layout direction in RTL contexts#11203

Open
saadpocalypse wants to merge 1 commit into
shadcn-ui:mainfrom
saadpocalypse:fix/input-otp-rtl
Open

fix(input-otp): enforce LTR layout direction in RTL contexts#11203
saadpocalypse wants to merge 1 commit into
shadcn-ui:mainfrom
saadpocalypse:fix/input-otp-rtl

Conversation

@saadpocalypse

Copy link
Copy Markdown

Description

In Right-to-Left (RTL) layout contexts (such as dir="rtl" or RTL document locales), InputOTP slots and typed digits were previously arranged and flowing from right to left. Since numeric verification codes (OTP) are read and entered Left-to-Right (LTR) in all languages, this caused digits to render in reverse order (e.g. 123456 rendered as 654321) and inverted the outer border-radius styling on slots.
This PR fixes the issue by enforcing [direction:ltr] on the container element and dir="ltr" on OTPInput.

Affected Components

  • InputOTP
  • InputOTPGroup
  • InputOTPSlot

Changes Made

  • Added [direction:ltr] to containerClassName in InputOTP across all component registry styles (new-york-v4, bases/radix, and bases/base).
  • Added dir="ltr" to OTPInput to guarantee LTR directionality for the input element and all descendant slot elements (InputOTPGroup and InputOTPSlot).

How to Test

  1. Render InputOTP inside an RTL container (<div dir="rtl">).
  2. Verify that slots flow Left-to-Right with slot 0 on the far left.
  3. Type numbers and observe that digits populate Left-to-Right.

Resolves #11201

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@saadpocalypse is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

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.

[bug]: InputOTP component slots and digits are reversed in Right-to-Left (RTL) layouts

1 participant