Skip to content

🪞 fix: Mirror Shared Primitives for Right-to-Left Layouts - #17265

Merged
berry-13 merged 22 commits into
devfrom
berry-13/rtl-primitives
Oct 20, 2026
Merged

berry-13 merged 22 commits into
devfrom
berry-13/rtl-primitives

Conversation

@berry-13

@berry-13 berry-13 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Shared components in packages/client used physical utilities, so in a right-to-left interface the Switch thumb travelled out of its track, Progress filled from the left, the dialog close button collided with right-aligned titles, Select, Combobox and DropdownMenu check indicators overlapped their labels, search inputs put the icon on the trailing edge with text running under it, and Radio, TimePicker and tooltip sides were mapped as LTR.

The primitives now use logical utilities (ms/me, ps/pe, inset-s/inset-e, text-start, logical radii and borders). The Switch thumb travel, Progress fill, chevrons and popover/tab animations cannot be logical, so they mirror through a new dir-rtl: variant. It matches :dir(rtl), and falls back to the nearest dir attribute in Chrome/Edge before 120. Vite's CSS minifier was lowering every :dir(rtl) to a :lang(...) list in built bundles, which mirrored by UI language and flipped LTR islands; client/vite.config.ts now excludes that lowering. utils/direction.ts resolves physical tooltip sides and Radio arrow keys against the element's own direction. SelectDropDown keeps left/right physical and adds logical start/end defaults. Slider follows the Radix DirectionProvider.

One of six RTL pull requests (core #17264, app shell #17266 and its class sweep #17269 have merged). Call sites on dev that should adopt dir-rtl: and start/end are tracked in berry-13#408.

Type of change

  • Bug fix

Testing

Tested environments/configuration:

  • Browser: Chromium (Playwright), desktop 1440x900 and mobile 390x844, light and dark
  • UI language: Arabic (lang=ar, document dir="rtl"), plus an English pass for LTR regressions
  • Database: local MongoDB with a seeded account and conversations

Automated tests:

  • Added utils/direction.spec.ts, RTL arrow-key cases in Radio.spec.tsx and TimePicker.spec.tsx, and a negated travel token case in theme/tailwind.spec.js
  • Updated DataTableSearch.spec.tsx, SecretInput.spec.tsx and InputNumber.spec.tsx for logical classes
  • Playwright rtl-primitives.spec.ts (switch, dialog close, floating label, tooltip side) runs against the built bundle with lang="en" and dir="rtl", so a lowered :dir() fails it
  • jest in packages/client; tsc --noEmit for packages/client and client; ESLint and static checks pass

Screenshots / recordings

The after shots were taken with all six RTL pull requests merged together locally; the before shots are from dev.

Before After
Before After
No before: new behavior After

Risk / compatibility

LTR output is unchanged: logical utilities resolve to the same physical sides under dir="ltr". Callers that pass side="left"/"right" to TooltipAnchor or InfoHoverCard now get the mirrored side in RTL.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • Required documentation PR: N/A

Copilot AI balanced review requested due to automatic review settings October 19, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T13:18:08.647119Z a031725 New commits
🔒 Security Review ✅ Completed 2026-10-19T15:14:49.081371Z ec4b36a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec4b36ae74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/components/Slider.tsx Outdated
Comment thread packages/client/src/components/Tooltip.tsx Outdated
Comment thread packages/client/src/components/SplitText.tsx Outdated
Comment thread packages/client/src/components/Switch.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b32f179a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/components/Slider.tsx Outdated
Comment thread packages/client/src/components/TimePicker.tsx Outdated
@codegraph-librechat codegraph-librechat Bot added the 🗺️ Client UI Foundation codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 19, 2026
@codegraph-librechat codegraph-librechat Bot added the 🗺️ UI Foundation codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 19, 2026
@berry-13
berry-13 force-pushed the berry-13/rtl-primitives branch from 4577aaf to f11d20c Compare October 20, 2026 09:14

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f11d20c148

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread client/vite.config.ts
Comment thread packages/client/src/components/SelectDropDown.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abbbe03f1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/theme/tokens.css Outdated
Comment thread packages/client/src/components/Slider.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 772039f319

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/theme/tokens.css
Comment thread packages/client/src/components/OGDialogTemplate.tsx
Comment thread packages/client/src/components/Button.tsx
@berry-13
berry-13 force-pushed the berry-13/rtl-primitives branch from 772039f to 2e00262 Compare October 20, 2026 11:17

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e00262a2a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/components/Slider.tsx Outdated
Comment thread packages/client/src/utils/direction.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b3111f346

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/components/Slider.tsx Outdated
Comment thread packages/client/src/components/ControlCombobox.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3e827644a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/src/components/Slider.tsx Outdated
Comment thread packages/client/src/components/ControlCombobox.tsx
Comment thread packages/client/src/components/Slider.tsx Outdated
@berry-13
berry-13 merged commit f2be28d into dev Oct 20, 2026
43 checks passed
@berry-13
berry-13 deleted the berry-13/rtl-primitives branch October 20, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Client UI Foundation codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) 🗺️ UI Foundation codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants