You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regardless of how many <OneTimePasswordField.Input> elements are rendered, if you copy and paste text into the field, all of the pasted characters are inserted, even beyond the intended length.
Expected behavior
Any characters beyond the configured number of inputs should be truncated—excess text should not be added to the field.
Observe that all digits appear, overflowing the intended 6-character limit.
Suggested solution
On value change (e.g. in the onValueChange handler), verify the new value’s length and slice it to the maximum allowed length before updating state.
Your environment
Software
Name(s)
Version
Radix Package(s)
@radix-ui/react-one-time-password-field
^0.1.6
React
n/a
^19.1.0
npm/yarn/pnpm
pnpm
10.11.0
The text was updated successfully, but these errors were encountered:
ohprettyhak
changed the title
[OneTimePasswordField] Pasting Input Exceeds Maximum Length
[OneTimePasswordField] Paste Exceeding Max Length Is Not Truncated
May 19, 2025
Bug report
Current Behavior
Regardless of how many
<OneTimePasswordField.Input>
elements are rendered, if you copy and paste text into the field, all of the pasted characters are inserted, even beyond the intended length.Expected behavior
Any characters beyond the configured number of inputs should be truncated—excess text should not be added to the field.
Reproducible example
https://www.radix-ui.com/primitives/docs/components/one-time-password-field
Suggested solution
On value change (e.g. in the
onValueChange
handler), verify the new value’s length and slice it to the maximum allowed length before updating state.Your environment
The text was updated successfully, but these errors were encountered: