Skip to content

fix(core): complete RTL physical→logical migration + enforce no-physical-properties (error) - #4564

Closed
nynexman4464 wants to merge 5 commits into
mainfrom
nynexman4464/feat/rtl-complete-physical-props
Closed

nynexman4464 wants to merge 5 commits into
mainfrom
nynexman4464/feat/rtl-complete-physical-props

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Completes the RTL physical→logical CSS migration for the core package and flips the guard rail on.

The last 22 physical left/right CSS properties across 9 components (Avatar, Banner, Calendar, Chat composer, Chat composer drawer, Dialog, FieldStatus, Markdown, Popover) are converted to their CSS logical equivalents — insetInlineStart/insetInlineEnd, the diagonal-aware borderStart*/borderEnd* corner radii, and textAlign: 'end' — so these components mirror correctly under RTL. Each conversion is a strict 1:1 logical rename; separate corner radii are kept separate (no collapsing) even where the value is the same.

With the migration finished, @astryx/no-physical-properties is promoted from warn to error in both the recommended and strict tiers. The rule was deliberately shipped at warn pending this migration (the config comment said "flip to error afterward" — this is afterward). It now gates against any future physical-property regression across the package.

Why logical properties

Physical left/right don't flip under RTL; the CSS logical equivalents (inset-inline-*, *-start/*-end) do. StyleX compiles these to native CSS logical properties, so the browser handles direction mapping — LTR rendering is pixel-identical (inset-inline-end === right, border-start-start-radius === border-top-left-radius, text-align: end === right in LTR).

Testing

  • pnpm lint (rule now at error): 0 errors — the whole repo passes with the rule gating.
  • pnpm --filter @astryxdesign/core typecheck: 0 errors.
  • Touched-component tests: 563/563 pass (28 files).
  • pnpm check:repo: green.
  • Core build (StyleX compile): succeeds; generated CSS confirms native logical props — LTR pixel-identical.

Completes the RTL migration. Refs #3636, #4116.

Follow-up: Avatar status-dot RTL fix (2nd commit)

The initial pass converted the Avatar status dot's anchor right → insetInlineEnd (right edge in LTR, left edge in RTL) but left the paired outward-push transform: translate(50%, 50%) physical — so under RTL the dot pulled inward toward the avatar center instead of hugging the bottom-leading corner. Fixed by making the X translate direction-aware (:is([dir="rtl"] *) → translate(-50%, 50%)); Y is direction-neutral. The dot now overhangs the bottom-inline-end corner in both directions (bottom-right LTR, bottom-left RTL).

Measured (Playwright, real StyleX-compiled CSS, dir inherited to the avatar subtree):

avatar centerX dot centerX corner
LTR 80 125.3 (+45.3, right of center) bottom-right ✅
RTL 920 874.7 (−45.3, left of center) bottom-left ✅

Exact mirror about the avatar center; LTR is unchanged / pixel-identical.

Lint gap noted: @astryx/no-physical-properties flags physical left/right keys but not physical translate() in transforms, so this bug class (logical anchor + unflipped physical transform) isn't lint-catchable today — candidate for a future rule enhancement.

@vercel

vercel Bot commented Jul 30, 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 Jul 31, 2026 10:00pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 30, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026 •

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

Avatar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 596 -
Complexity N/A Very High (71) -
Banner (@astryxdesign/core) · 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) -
Calendar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1351 -
Complexity N/A Very High (135) -
Chat (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 5354 -
Complexity N/A Very High (438) -
Dialog (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 616 -
Complexity N/A Very High (84) -
Markdown (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 2857 -
Complexity N/A Very High (201) -
Popover (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 534 -
Complexity N/A Very High (51) -
Resizable (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 730 -
Complexity N/A Very High (83) -
Slider (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 796 -
Complexity N/A Very High (108) -

Bundle Size Summary

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

Accessibility Audit

Status: 2 accessibility violation(s) found — 2 serious.

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)

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

github-actions Bot added a commit that referenced this pull request Jul 30, 2026
nynexman4464 added a commit that referenced this pull request Jul 30, 2026
#4564 converted the status dot's anchor from `right` to `insetInlineEnd`
(right edge in LTR, left edge in RTL) but left the paired outward-push
`transform: translate(50%, 50%)` physical, so under RTL the dot pulled inward
toward the avatar center instead of hugging the bottom-leading corner.

Make the X translate direction-aware via the established `:is([dir="rtl"] *)`
idiom (as in MobileNav/Carousel): default `translate(50%, 50%)`, RTL
`translate(-50%, 50%)`. Only the X sign flips; Y (+50%, downward) is
direction-neutral. The dot now overhangs the bottom-inline-end corner in both
directions (bottom-right LTR, bottom-left RTL), matching the anchor. LTR is
unchanged / pixel-identical.

Note: the no-physical-properties lint flags physical `left`/`right` keys but
not physical `translate()` in transforms, so this class of bug (logical anchor
+ unflipped physical transform) is not lint-catchable today.
github-actions Bot added a commit that referenced this pull request Jul 30, 2026
github-actions Bot added a commit that referenced this pull request Jul 30, 2026
github-actions Bot added a commit that referenced this pull request Jul 30, 2026
…cal-properties (error)

Convert the final physical left/right CSS properties in the core package to
their logical equivalents (insetInlineStart/End, borderStart*/End* radii,
textAlign: end) across Avatar, Banner, Calendar, Chat composer, Chat composer
drawer, Dialog, FieldStatus, Markdown, and Popover, so they mirror correctly
under RTL. With the migration complete, promote @astryx/no-physical-properties
from warn to error in both the recommended and strict tiers to gate against
regressions. LTR rendering is pixel-identical.
#4564 converted the status dot's anchor from `right` to `insetInlineEnd`
(right edge in LTR, left edge in RTL) but left the paired outward-push
`transform: translate(50%, 50%)` physical, so under RTL the dot pulled inward
toward the avatar center instead of hugging the bottom-leading corner.

Make the X translate direction-aware via the established `:is([dir="rtl"] *)`
idiom (as in MobileNav/Carousel): default `translate(50%, 50%)`, RTL
`translate(-50%, 50%)`. Only the X sign flips; Y (+50%, downward) is
direction-neutral. The dot now overhangs the bottom-inline-end corner in both
directions (bottom-right LTR, bottom-left RTL), matching the anchor. LTR is
unchanged / pixel-identical.

Note: the no-physical-properties lint flags physical `left`/`right` keys but
not physical `translate()` in transforms, so this class of bug (logical anchor
+ unflipped physical transform) is not lint-catchable today.
@nynexman4464
nynexman4464 force-pushed the nynexman4464/feat/rtl-complete-physical-props branch from e9d6989 to 9c43eb3 Compare July 31, 2026 18:03
github-actions Bot added a commit that referenced this pull request Jul 31, 2026
…fix Popover/Slider/ResizeHandle off-center in RTL
github-actions Bot added a commit that referenced this pull request Jul 31, 2026
@nynexman4464

Copy link
Copy Markdown
Contributor Author

Superseded by the 3-PR stack #4613 → #4614 → #4615 (byte-identical code, split for reviewability). Closing to avoid a double-land.

@github-actions
github-actions Bot deleted the nynexman4464/feat/rtl-complete-physical-props branch August 1, 2026 06:54
nynexman4464 added a commit that referenced this pull request Aug 7, 2026
rtl-audit.mjs hardcoded a "known real bug pending a fix branch" note for the
Avatar status-dot, pointing at #4564. Both halves are now wrong:

- Avatar passes D5. Across all 15 Avatar stories in a full sweep the verdicts
  are only N-A and pass — zero fails.
- #4564 was closed without merging, so the referenced fix branch never landed.

Because the banner printed whenever ANY D5 fail existed, not just an Avatar
one, the next unrelated finding would have been captioned with a misleading
"known real bug" pointing at a dead PR.

Removes the field and both consumers (the pr-rtl scorecard in ci.yml and the
weekly summary).

Test plan: full-sweep report confirms Avatar is clean (15 stories, N-A/pass
only). Audit runs and the emitted report no longer carries the key
(positionalMirror keys: total, applicable, pass, fail, na, tolerancePx,
results). The findings-path summary still renders its D5 table with the
banner gone. ci.yml parses; prettier-clean.

This branch was successfully deployed

1 active deployment
Preview — 704b5146 Deployed Jul 31, 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