Repository navigation
fix(text-input): place accessories and label correctly in RTL - #5219
Conversation
…ical start label offset
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
/review |
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
src/components/TextInput/utils.ts:359 |
Dropping accessory mirroring breaks RTL where only LocaleProvider sets direction (RNW) |
Not in the reviewers' prompt (1 file)
src/components/__tests__/__snapshots__/TextInput.test.tsx.snap: generated or a lockfile, so its lines were left out
Reviewed with this repository's own Sentinel configuration (677ab9f2b2cf).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 50d4126. The verdict and the full list are in the summary comment.
Removing the RTL accessory swap fixes two things that had no test: the error icon now shows when only a startAccessory is set, and a lone endAccessory leaves the label at the edge offset. Both tests fail with the swap back in. Also names the RTL tree-order test after what it checks.
startAccessory and endAccessory follow the writing direction, so in RTL startAccessory is on the right on every platform. On web that differs from v5, where `left` stayed on the left.
React Native Web resolves `start` from a `dir` prop on one of its own Views and ignores `<html dir>`. In the setup the RTL guide documents, `<html dir="rtl">` with PaperProvider's direction, the label offset compiled to `left`: the label stayed on the left while the accessories moved, and it overlapped a lone endAccessory. On web the label now takes the physical side from Paper's direction, as Switch does for its thumb. Native keeps `start`. Replaces the serialized-tree test with RTL tests on web that fail without this change.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thanks for the fix! Dropping the swap is the right fix for iOS and Android. To keep this moving, I pushed a few commits to your branch and merged
I also shortened the description and added screenshots. Nothing else is needed from you, merging now. Thanks again! |
…#5255) On web, LocaleProvider only passed the direction to Paper's components. In a `<LocaleProvider direction="rtl">` subtree, Switch and the TextInput label went right to left while Button, Chip, List.Item and TextInput accessories stayed left to right, and a lone `endAccessory` overlapped the label. On web, LocaleProvider now wraps its children in a `display: contents` View with `dir`, and Portal carries the direction to menus, dialogs and other portaled content. PaperProvider and native are unchanged. The RTL guide describes the web behavior. Follow-up to #5219.
Motivation
In RTL,
TextInputswappedstartAccessoryandendAccessoryalthough its row already mirrors, so both showed on the wrong side. They now follow the start and end sides on iOS, Android and web, the label sits next to the start accessory, and the error icon shows when only astartAccessoryis set.Related issue
Fixes #5214
Screenshots / Videos
Test plan
Example app, RTL on, TextInput screen: toggle Leading icon, Trailing icon and Error in both variants, on iOS, Android and web.