Repository navigation
fix: preserve Input.OTP digits when pasting formatted text - #59580
Conversation
|
|
👁 Visual Regression Report for PR #59580 Passed ✅
🎊 Congrats! No visual-regression diff found.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
More templates
commit: |
Bundle ReportChanges will decrease total bundle size by 39.63kB (-1.21%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #59580 +/- ##
===========================================
Coverage 100.00% 100.00%
===========================================
Files 835 833 -2
Lines 17689 16053 -1636
Branches 4863 4211 -652
===========================================
- Hits 17689 16053 -1636 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|


中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
Fixes #59579
Minimal reproduction on StackBlitz · Standalone source
The reproduction uses published
[email protected]and intentionally shows the bug. Runnpm installandnpm run devif the online preview is unavailable.💡 Background and Solution
When a six-cell
Input.OTPuses a formatter that removes non-digits, pasting123 456produces only12345. The raw input is truncated before formatting, so the separator consumes a slot and the final digit is discarded. Pasting1 2 3 4 5 6loses even more digits.Apply the existing formatter before limiting the resulting cells to
length. This preserves valid characters and keeps the final cell count bounded. The existing focus handling and callback flow remain in place; there is no public API change.Regression tests cover spaces and hyphens, multiple separators, pasting into a middle cell, callback values, focus, and the final length limit. The PR is limited to the OTP implementation and its existing test file. The repository's pre-commit formatter also wrapped one existing separator assertion without changing it.
Screenshots
The same six-cell example after inserting
123 456: before uses published[email protected]; after uses this branch's source.Narrow viewport: before / after.
Verification
Input.insertText, not the OS clipboard.git diff --checkpassed.feature(fcfd9e5414b6251894111874c424fc5abf2aa388) completed without conflicts; this PR targetsmaster.Broader checks have existing failures, reproduced against the unchanged base (
05140c7f82c3c776bb7ed61272a070f9db403fc5):compact-style,align, andaddonextended-context demos. The same three failures occur on the base.Those unrelated failures and snapshots are left unchanged. Browser production bundles were built; a full package build was not run.
📝 Change Log