Repository navigation
feat(ui): add shared RTL/LTR direction foundation - #336
Merged
Merged
Conversation
Add reusable direction-safe primitives for Persian RTL UI without exposing Persian to user language selectors yet: - globals.css: .ltr-island (LTR + bidi isolation for emails, URLs, codes, numbers inside RTL pages) and [dir=rtl] .rtl-flip (mirrors directional icons). - New shared Ltr component rendering dir="ltr" LTR islands. - Convert shared ui/ and layout/ components from physical left/right utilities to Tailwind v4 logical utilities (ms/me/ps/pe/start/end/ text-start/text-end/border-s/rounded-s), which are LTR-identical, so existing en/es/pt rendering is unchanged while the same components mirror correctly under dir="rtl". Directional chevrons get .rtl-flip. - Genuinely physical cases (sheet/drawer side positioning, sidebar rail/ inset geometry) stay physical and are documented. - New tests/rtl-foundation.test.ts regression guard (wired into npm test). Verified it fails on injected physical-utility regressions. Refs #241
18 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Add a shared RTL/LTR UI direction foundation for Persian (Batch C of issue #241): convert shared ui/ and layout/ components from physical left/right Tailwind utilities to logical utilities (ms/me/ps/pe/start/end/text-start/text-end/border-s/rounded-s), add .ltr-island and [dir=rtl] .rtl-flip CSS rules in globals.css, add a shared Ltr component for explicit LTR islands, and add a regression test guarding against physical direction utilities in shared components. Persian must remain hidden from user language selectors; en/es/pt rendering must be unchanged.
What Changed
frontend/src/components/ui/) and layout components (frontend/src/components/layout/) from physical left/right Tailwind utility classes to logical direction utilities (ms-*,me-*,ps-*,pe-*,start-*,end-*,text-start,border-s)..ltr-islandand[dir="rtl"] .rtl-flipCSS rules inglobals.cssalongside a new polymorphic<Ltr>component to render isolated LTR content blocks.tests/rtl-foundation.test.tstonpm testto guard against physical direction utilities in shared components and verify<Ltr>component rendering.Risk Assessment
✅ Low: The RTL/LTR foundation changes are well-bounded, use standard Tailwind logical utility mappings that preserve LTR behavior while enabling RTL support, and include thorough regression tests.
Testing
Executed targeted automated test suites (test:rtl-foundation, test:translations, test:auth-ui-deterministic, and build:frontend) alongside end-to-end Chromium visual rendering and computed style verification via Playwright, capturing side-by-side LTR vs RTL screenshots and rendered HTML artifacts proving logical utility alignment, Ltr bidi isolation, icon mirroring, and Persian exclusion from user language selectors.
/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M06PQ5YM9CKG5QHJNVFPMFTC/rtl-ltr-foundation-overview.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M06PQ5YM9CKG5QHJNVFPMFTC/ltr-islands-bidi-evidence.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M06PQ5YM9CKG5QHJNVFPMFTC/rtl-icon-flip-evidence.png)/var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/no-mistakes-evidence/01M06PQ5YM9CKG5QHJNVFPMFTC/logical-primitives-rtl-evidence.png)Evidence: Rendered RTL and LTR Test Harness HTML
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
tests/rtl-foundation.test.ts:125- tests/rtl-foundation.test.ts verifies the Ltr component by reading Ltr.tsx as raw source text with fs.readFileSync and asserting regex matches instead of executing or rendering the component through its public React interface to assert observable output and props.🔧 Fix: Verify Ltr component using React rendering assertions
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run test:rtl-foundationnpm run test:translationsnpm run test:auth-ui-deterministicnpm run build:frontendPlaywright Chromium headless visual verification and computed CSS style assertions (direction, unicode-bidi, transform scaleX(-1), language selector exclusion)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.