Skip to content

fix(core): migrate physical left/right CSS to logical properties for RTL (Phase 2) - #4434

Merged
nynexman4464 merged 1 commit into
mainfrom
nynexman4464/feat/rtl-logical-props
Jul 27, 2026
Merged

nynexman4464 merged 1 commit into
mainfrom
nynexman4464/feat/rtl-logical-props

Conversation

@nynexman4464

Copy link
Copy Markdown
Contributor

Summary

RTL Phase 2 (refs #4116): a mechanical 1:1 conversion of physical left/right CSS properties to their logical equivalents across @astryxdesign/core. This is a no-op in LTR (logical inline-start/inline-end resolve to left/right in LTR) and makes components mirror correctly under dir="rtl".

Builds on the direction API from #4269 (now merged).

What changed — 41 conversions across 20 files

Physical → Logical Count
textAlign: 'left'/'right' 'start'/'end' 6
borderLeft* / borderRight* (width/style/color) borderInlineStart* / borderInlineEnd* 15
left: / right: (positioning) insetInlineStart: / insetInlineEnd: 19
marginLeft (inline style, TreeListItem) marginInlineStart 1

One-to-one, not collapsed. Symmetric borderLeftWidth + borderRightWidth pairs become two distinct properties (borderInlineStartWidth + borderInlineEndWidth), not a single borderInlineWidth shorthand. This keeps the diff a clean mechanical map and each side independently overridable.

Deliberately left for Phase 4 (behavioral / higher-risk)

Not touched here — these need direction-aware logic or careful visual review, not a rename:

  • Slider / Resizable — left: ${pct}% thumb positioning (behavioral)
  • Calendar — range-pill corner radii
  • ChatMessageBubble — asymmetric tail corner radii
  • Table — sticky-column gradient direction (linear-gradient(to right/left))
  • Directional chevron icons (Pagination handled in feat(core): RTL direction API (useDirection + getLocaleDirection + dir prop) #4269; the rest are Phase 3/4)
  • TreeListBranches guide offsets — now need to flip in concert with the converted marginInlineStart for coherent RTL tree mirroring
  • Markdown textAlign: 'right' — semantic (from |---:| source alignment), intentionally preserved
  • translateX(-50%) centering — direction-agnostic, untouched

Testing

  • No snapshot changes — the correctness guard for a pure LTR-equivalent refactor. ✅
  • Component tests pass. TreeList.test.tsx updated: it asserts on the inline-style property name (margin-inline-start), so the assertion + selector followed the source rename — a functional coupling, not a snapshot edit.
  • typecheck clean (StyleX accepts the logical keys); check:repo green.
  • Changeset: [fix], patch, @astryxdesign/core.

Follow-ups

  • Lint rule to prevent regressions (physical props creeping back) — under evaluation; leaning toward the official @stylexjs/eslint-plugin propLimits for key-based bans + a small custom rule for value cases (textAlign). Will land after Phase 2+4 so it doesn't flag in-flight work.

…valents for RTL

Phase 2 of the RTL migration: a mechanical, one-to-one sweep converting
physical left/right CSS properties to their logical (inline) equivalents.
No-op in the default LTR direction; enables correct mirroring under dir=rtl.

- textAlign left/right -> start/end
- borderLeft*/borderRight* -> borderInlineStart*/borderInlineEnd* (kept as
  separate start/end declarations, not collapsed to shorthand)
- static left/right positioning -> insetInlineStart/insetInlineEnd
- inline marginLeft indentation -> marginInlineStart (TreeList)

Behavioral/computed positioning (Slider, Resizable, floating layers,
anchor-positioned popovers, transform-based centering) and directional
radii are intentionally deferred to later phases.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 27, 2026
@vercel

vercel Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 27, 2026 9:11pm

Request Review

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Jul 27, 2026
github-actions Bot added a commit that referenced this pull request Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Banner · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 344 -
Complexity N/A High (24) -
Button · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 564 -
Complexity N/A Very High (63) -
Chat · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 5337 -
Complexity N/A Very High (437) -
CodeBlock · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1561 -
Complexity N/A Very High (84) -
CommandPalette · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 988 -
Complexity N/A Very High (110) -
DateRangeInput · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 481 -
Complexity N/A Very High (56) -
DropdownMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 952 -
Complexity N/A Very High (95) -
Field · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 513 -
Complexity N/A High (29) -
Lightbox · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 569 -
Complexity N/A Very High (62) -
NavMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 305 -
Complexity N/A High (24) -
Selector · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1283 -
Complexity N/A Very High (103) -
TabList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 807 -
Complexity N/A Very High (42) -
Table · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1920 -
Complexity N/A Very High (101) -
Thumbnail · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 308 -
Complexity N/A Very High (34) -
TreeList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 756 -
Complexity N/A Very High (78) -
Typeahead · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1092 -
Complexity N/A Very High (152) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: 6 accessibility violation(s) found — 1 critical, 4 serious, 1 moderate.

Banner - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Chat - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/8 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/16 stories · Learn more
    • WCAG: 4.1.2 (Level A)
TabList - 1 issue(s)
  • 🟡 moderate: Ensure landmarks are unique
    • Rule: landmark-unique · Affects 2/11 stories · Learn more
Table - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Thumbnail - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/12 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@nynexman4464
nynexman4464 merged commit d600202 into main Jul 27, 2026
18 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/feat/rtl-logical-props branch July 28, 2026 06:57
AKnassa added a commit to AKnassa/astryx that referenced this pull request Aug 27, 2026
The eight add/add conflicts resolved to main's files in the merge; this
ports back only the assertions main does not cover and that still hold
today (render gates and sizing, layer groups and masks, style restore,
registry glyph, xstyle forwarding, context guards). Duplicates of main's
coverage are dropped rather than kept twice.

Four files went stale over the 815-commit gap and follow today's
behavior: the hidden data-table fallback (meta#4382) means chart label and
tooltip queries scope to the svg; useTooltip's touch guard is per
pointer type (meta#5248) and a controlled tooltip reports Escape through
onHide (meta#4881); TableHeaderCell dividers are logical inline-end
properties (meta#4434).
cixzhang pushed a commit that referenced this pull request Sep 3, 2026
…sted viz packages and hooks (#4295) (#4377)

* test: cover the viz packages and five core hooks

packages/charts and packages/vega had no functional tests at all, and
packages/lab's chart primitives (Chart*, Radial*, ThreeD*, Sankey*,
SVGIcon) rendered nothing under test. Add colocated tests for each, plus
renderHook tests for the three useCalendar* hooks, useCollapsible and
useTableFilterState.

Harness: charts and vega were falling through to the `node` vitest
project, which has no jsdom, no StyleX transform and no jest-dom, so
their tests could never have run there. Move both into the `ui` project
and give vega the test scripts the other packages already have.

53 test files, 307 tests. Verified: full suite 7943 pass / 430 files,
still green with packages/core/dist absent (the cold-CI path, which
charts needs because it imports core by bare name for values); 8 sampled
mutations across all four packages, each killed by exactly the new test.

Refs #4295

* test: cover remaining core hooks and components

Finishes the functional-coverage sweep started in 64d9ea3. Adds
renderHook tests for useScrollLock, useLightbox, useChatPasteAsToken,
useImperativeAlertDialog, useTranslator and useTooltip, plus colocated
tests for the components that had none: CommandPaletteEmpty,
InputClearButton, TypeaheadItem, ChatSendButton, PowerSearchToken,
PowerSearchFilterEditor and TableHeaderCell.

Two of the issue's nine "zero-test" components already had tests
(ChatComposerDrawer, MobileNavToggle, from #3996 and #3721), so the
inventory is smaller than the issue states.

Extracts the StyleX declaration read-back helper that three of these
files each needed into __tests__/stylexDeclarations.ts rather than
landing a third copy.

Two branches are deliberately left uncovered, with the reason recorded
next to them: the ignored-onOpenChange(true) guards in useLightbox and
useImperativeAlertDialog are unreachable through the public surface,
and reaching into element props to force them both breaks the repo's
no-react-introspection lint rule and asserts a value that is already
settled. useTooltip's focus paths are also omitted -- jsdom resolves
:focus-visible as :focus, so those tests would pass with the gate
deleted.

Verified: 8101 tests / 443 files green, eslint and prettier clean,
core typecheck clean; three sampled mutations (the send-button variant
ternary, CommandPaletteEmpty's xstyle merge, useTooltip's touch
suppression) each killed by exactly one new test.

Refs #4295

* test: port the branch's remaining assertions onto main's test files

The eight add/add conflicts resolved to main's files in the merge; this
ports back only the assertions main does not cover and that still hold
today (render gates and sizing, layer groups and masks, style restore,
registry glyph, xstyle forwarding, context guards). Duplicates of main's
coverage are dropped rather than kept twice.

Four files went stale over the 815-commit gap and follow today's
behavior: the hidden data-table fallback (#4382) means chart label and
tooltip queries scope to the svg; useTooltip's touch guard is per
pointer type (#5248) and a controlled tooltip reports Escape through
onHide (#4881); TableHeaderCell dividers are logical inline-end
properties (#4434).

* test(calendar): assert month labels as English literals

CI's lint job fails on the one raw Intl call left in these tests:
main's no-raw-intl-locale rule keeps its test-oracle allowlist inside
the rule, and this file is not on it. The oracle was also the wrong
side: with no InternationalizationProvider mounted, useLocale() resolves
to 'en', so the hook's labels never followed the machine locale that
Intl.DateTimeFormat(undefined) reads. Literal 'April 2026' style
assertions match Calendar.test.tsx and drop the Intl dependency.

This branch was successfully deployed

1 active deployment
Preview — 2f88009c Deployed Jul 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant