Skip to content

fix(locale): lay out a LocaleProvider subtree in its direction on web - #5255

Open
Doberjohn wants to merge 1 commit into
mainfrom
@Doberjohn/locale-subtree-dir
Open

Doberjohn wants to merge 1 commit into
mainfrom
@Doberjohn/locale-subtree-dir

Conversation

@Doberjohn

@Doberjohn Doberjohn commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

On web, LocaleProvider only told Paper's components the direction, so under a lone <LocaleProvider direction="rtl"> Switch and the TextInput label went right to left while Button, Chip, List.Item and TextInput accessories stayed left to right. A lone endAccessory overlapped the label.

LocaleProvider now wraps its children on web in a display: contents View with dir, and Portal carries it to menus and dialogs. PaperProvider and native are unchanged.

Related issue

Follow-up to #5219.

Screenshots / Videos

Web, before and after:

before-web after-web

Test plan

  • New LocaleProvider tests fail without the change.
  • Example on web: TextInput, Button, Chip, Switch and an open Menu in a LocaleProvider subtree.

LocaleProvider only told Paper's components the direction, so on web a
subtree under it mixed both directions: Switch and the TextInput label
followed it, while rows, start and end styles, and the icons of Button,
Chip and List.Item kept the page's direction. A lone endAccessory
overlapped the TextInput label.

On web, LocaleProvider now also wraps its children in a View with `dir`
and `display: contents`: react-native-web reads `dir` for start and end
styles, and the browser for rows and text. Portal carries it to content
opened from the subtree, such as a Menu. PaperProvider still leaves the
layout direction of the app to the page (`<html dir>`), and native is
unchanged, since I18nManager sets the layout direction for the whole app.
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Found potential problems with the pull request:

  • The description is too long. Please keep it under 1000 characters.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 290ce23

No open findings.

Reviewed with this repository's own Sentinel configuration (3d9dee332cd6).

💬 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant