Skip to content

fix(text-input): place accessories and label correctly in RTL - #5219

Merged
Doberjohn merged 6 commits into
callstack:mainfrom
EnesKartal:fix/textinput-rtl-accessories
Nov 19, 2026
Merged

Doberjohn merged 6 commits into
callstack:mainfrom
EnesKartal:fix/textinput-rtl-accessories

Conversation

@EnesKartal

@EnesKartal EnesKartal commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

In RTL, TextInput swapped startAccessory and endAccessory although 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 a startAccessory is set.

Related issue

Fixes #5214

Screenshots / Videos

android-rtl-leading-error
android-rtl-leading-trailing
ios-rtl-leading-trailing
web-rtl-leading-trailing

Test plan

Example app, RTL on, TextInput screen: toggle Leading icon, Trailing icon and Error in both variants, on iOS, Android and web.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Doberjohn Doberjohn added this to the 6.0.0 milestone Nov 18, 2026
@Doberjohn

Copy link
Copy Markdown
Collaborator

/review

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 50d4126

1 finding(s): 1 minor.

🟡 Minor (1)

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.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 50d4126. The verdict and the full list are in the summary comment.

Comment thread src/components/TextInput/utils.ts Resolved
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.
Copilot AI balanced review requested due to automatic review settings November 19, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Doberjohn

Copy link
Copy Markdown
Collaborator

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 main, which needed one snapshot update:

  • Tests for two things your change also fixes in RTL: the error icon now shows when only a startAccessory is set, and a lone endAccessory no longer pushes the label in.
  • A sentence in the migration guide on where the accessories sit in RTL, since on web it differs from v5's left.
  • On web, the label now takes right or start from Paper's direction, as Switch does. React Native Web resolves start only from a dir prop on its own Views, so with <html dir="rtl"> (the RTL guide's setup) the label stayed on the left and overlapped a lone endAccessory.

I also shortened the description and added screenshots. Nothing else is needed from you, merging now. Thanks again!

@Doberjohn Doberjohn changed the title fix(TextInput): avoid double-mirroring accessories in RTL and use logical start label offset fix(text-input): place accessories and label correctly in RTL Nov 19, 2026
@Doberjohn
Doberjohn merged commit c8c3a39 into callstack:main Nov 19, 2026
13 checks passed
Doberjohn added a commit that referenced this pull request Nov 20, 2026
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextInput: in RTL, startAccessory and endAccessory render on the wrong sides, and on web the label overlaps the start accessory

3 participants