[otp field] Fix RTL arrow navigation#4847
Conversation
Code Review (GPT-5.5)Approve ✅ The patch fixes the OTP RTL arrow-key bug at the right abstraction level and matches both Base UI’s RTL composite convention and native RTL input caret behavior. 1. Bugs / Issues (None)Root Cause & Patch AssessmentThe bug was that This is the right shape: Home/End and Backspace/Delete semantics remain unchanged, while only horizontal navigation is direction-aware. Pattern Consistency AssessmentThis matches the repo’s existing RTL pattern for horizontal composites: RTL reverses the previous/next arrow keys. It is also consistent with native RTL text input behavior. I verified in headless Chromium that a native One caveat, expected for Base UI: this follows Test Coverage AssessmentThe added RTL tests cover normal arrow movement and Ctrl/Cmd boundary movement, which are the affected branches. Validation run:
|
commit: |
Bundle size
PerformanceTotal duration: 1,138.35 ms +25.93 ms(+2.3%) | Renders: 50 (+0) | Paint: 1,757.30 ms +44.08 ms(+2.6%) No significant changes — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
5a856e2 to
e94d54c
Compare
Follow-up to #4840. OTP Field still handled slot arrow navigation as LTR, so RTL users moved to the visually wrong slot.
Root cause
OTPField.Inputhandled left/right keys itself and did not readDirectionProvider.Changes