fix(InputOTP): limit slot transition to color and box-shadow only#11179
Open
gonzoblasco wants to merge 2 commits into
Open
fix(InputOTP): limit slot transition to color and box-shadow only#11179gonzoblasco wants to merge 2 commits into
gonzoblasco wants to merge 2 commits into
Conversation
Contributor
|
@gonzoblasco is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
gonzoblasco
force-pushed
the
fix/11157-input-otp-keyboard-layout-shift
branch
2 times, most recently
from
July 16, 2026 11:36
f013644 to
d0eb827
Compare
Replace transition-all with transition-[color,box-shadow] in all InputOTPSlot variants to prevent unwanted layout shift during keyboard navigation (Tab/Shift+Tab). When the hidden input in the input-otp library gains or loses focus via keyboard navigation, the data-active attribute toggles on the slot div. Only border-color and box-shadow actually change, but transition-all animates every property including z-index and potential layout-affecting changes during the transition frame, causing visible content shift. This change covers all 14 style variants that used transition-all plus the new-york-v4 registry component, aligning them with the rhea and sera variants which already used scoped transitions. Fixes shadcn-ui#11157
gonzoblasco
force-pushed
the
fix/11157-input-otp-keyboard-layout-shift
branch
from
July 16, 2026 11:39
d0eb827 to
5f7dad3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
InputOTPSlotusestransition-allwhich animates every CSS property when thedata-activestate changes during keyboard navigation (Tab/Shift+Tab). This causes a visual layout shift where the page content jumps to the left.Root Cause
When the hidden input inside the
input-otplibrary gains or loses focus via keyboard navigation, thedata-activeattribute toggles on the slot div. Onlyborder-colorandbox-shadowactually change (viadata-[active=true]:border-ringanddata-[active=true]:ring-3), buttransition-allanimates every property — includingz-indexand other layout-affecting changes during the transition frame — causing visible content shift.Fix
Replaced
transition-allwithtransition-[color,box-shadow]to scope transitions to only the properties that actually change on focus. This eliminates the layout shift while keeping smooth visual feedback.Changes
Updated all 15 files that had
transition-allacross the codebase:apps/v4/registry/new-york-v4/ui/input-otp.tsx(registry component)apps/v4/styles/(base-luma, base-lyra, base-maia, base-mira, base-nova, base-nova/ui-rtl, base-vega, radix-luma, radix-lyra, radix-maia, radix-mira, radix-nova, radix-nova/ui-rtl, radix-vega)The
rheaandseravariants already used scoped transitions (transition-[color,box-shadow]andtransition-[color,border-color]respectively), confirming this pattern is correct.Fixes #11157
Testing
transition-allremains in anyinput-otp.tsxfilerheaandseravariants