Repository navigation
feat(core): add logical start/end to Dialog position; deprecate physical left/right - #4568
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 30, 2026 23:59
nynexman4464
added a commit
that referenced
this pull request
Jul 30, 2026
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsDialog (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
nynexman4464
added a commit
that referenced
this pull request
Jul 31, 2026
nynexman4464
force-pushed
the
nynexman4464/feat/dialog-position-logical
branch
from
July 31, 2026 18:00
72c25ef to
a55fd82
Compare
nynexman4464
marked this pull request as ready for review
July 31, 2026 23:24
nynexman4464
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
July 31, 2026 23:24
…cal left/right Dialog's `position` prop exposes physical `left`/`right` offsets. Silently mapping those to logical inset-inline-start/end (so they mirror under RTL) would be a breaking change: consumers relying on `left` meaning the visual-left edge would see their dialogs jump to the other side under RTL. So instead of flipping the existing props, this adds a proper deprecation path: - Add logical `start`/`end` to DialogPosition. They map to `inset-inline-start`/`inset-inline-end` and MIRROR under RTL — the preferred, RTL-safe way to anchor a dialog to an inline edge. - Deprecate `left`/`right` via @deprecated JSDoc. They still work and stay PHYSICAL (never mirror) for backward-compat; they'll be removed in a future major. A physical-only consumer gets EXACTLY today's behavior — non-breaking. - Precedence: if both a logical offset and its physical counterpart are set, the logical one wins (the physical is suppressed so they can't fight). - Ship a codemod (packages/cli/codemods/transforms/v0.2.1, `migrate-dialog-position-to-logical`) that rewrites `<Dialog position={{left, right}}>` to `{{start, end}}`. It is OPTIONAL (left/right still work) and alias/subpath-import aware; it skips ambiguous cases (a variable position, or left/right already coexisting with start/end). The physical→logical mapping + precedence is unit-tested via a pure exported `resolveDialogPositionOffsets` (the StyleX create() body must stay an inline object literal, so the logic is mirrored there and tested here). Docs/story (LogicalPosition) updated. Changeset is a `feat` (patch) — additive + a deprecation, no break. Future-major follow-up: drop left/right after adoption.
…ed key helper/map)
… (kill duplication)
…bid mixing at compile time)
nynexman4464
force-pushed
the
nynexman4464/feat/dialog-position-logical
branch
from
July 31, 2026 23:55
a55fd82 to
3627dbb
Compare
nynexman4464
enabled auto-merge (squash)
July 31, 2026 23:56
github-actions
Bot
deleted the
nynexman4464/feat/dialog-position-logical
branch
August 1, 2026 06:54
nynexman4464
added a commit
that referenced
this pull request
Aug 3, 2026
Consumer side: add an 'it just works' note (set dir once, components mirror themselves) and correct the stale caveat that claimed overlays (menus/dialogs) aren't mirrored yet -- they mirror via logical CSS anchor positioning now (#4568 and the Layer logical placement). Contributor side: replace the single 'read useDirection() to swap an icon' example -- the exact anti-pattern this stack removes from Pagination -- with a priority hierarchy: (1) logical CSS, (2) icons via rtlStyles.mirror, (3) behavioral logic via lazy isRtlElement / focus-hook auto-detect, (4) useDirection() context only as a render-time last resort. Notes that isRtl on the focus hooks is deprecated and that no component reads direction from context at render time after the CSS-mirror migration.
nynexman4464
added a commit
that referenced
this pull request
Aug 4, 2026
Consumer side: add an 'it just works' note (set dir once, components mirror themselves) and correct the stale caveat that claimed overlays (menus/dialogs) aren't mirrored yet -- they mirror via logical CSS anchor positioning now (#4568 and the Layer logical placement). Contributor side: replace the single 'read useDirection() to swap an icon' example -- the exact anti-pattern this stack removes from Pagination -- with a priority hierarchy: (1) logical CSS, (2) icons via rtlStyles.mirror, (3) behavioral logic via lazy isRtlElement / focus-hook auto-detect, (4) useDirection() context only as a render-time last resort. Notes that isRtl on the focus hooks is deprecated and that no component reads direction from context at render time after the CSS-mirror migration.
nynexman4464
added a commit
that referenced
this pull request
Aug 4, 2026
Consumer side: add an 'it just works' note (set dir once, components mirror themselves) and correct the stale caveat that claimed overlays (menus/dialogs) aren't mirrored yet -- they mirror via logical CSS anchor positioning now (#4568 and the Layer logical placement). Contributor side: replace the single 'read useDirection() to swap an icon' example -- the exact anti-pattern this stack removes from Pagination -- with a priority hierarchy: (1) logical CSS, (2) icons via rtlStyles.mirror, (3) behavioral logic via lazy isRtlElement / focus-hook auto-detect, (4) useDirection() context only as a render-time last resort. Notes that isRtl on the focus hooks is deprecated and that no component reads direction from context at render time after the CSS-mirror migration.
nynexman4464
added a commit
that referenced
this pull request
Aug 4, 2026
…direction read (#4687) * refactor(core): mirror Pagination chevrons under RTL via CSS, not JS direction read Pagination was the last component selecting a physical icon name from a render-time useDirection() read. Switch it to render fixed chevronLeft/ chevronRight glyphs wrapped in the shared rtlStyles.mirror (scaleX(-1)), so they flip purely from an ancestor's dir via the CSS cascade -- matching Calendar and the rest of the library. This removes the only internal consumer of the i18n direction context and eliminates a potential server/client hydration mismatch on the chevrons. No API change. * docs(i18n): align RTL guidance with the CSS-mirror model Consumer side: add an 'it just works' note (set dir once, components mirror themselves) and correct the stale caveat that claimed overlays (menus/dialogs) aren't mirrored yet -- they mirror via logical CSS anchor positioning now (#4568 and the Layer logical placement). Contributor side: replace the single 'read useDirection() to swap an icon' example -- the exact anti-pattern this stack removes from Pagination -- with a priority hierarchy: (1) logical CSS, (2) icons via rtlStyles.mirror, (3) behavioral logic via lazy isRtlElement / focus-hook auto-detect, (4) useDirection() context only as a render-time last resort. Notes that isRtl on the focus hooks is deprecated and that no component reads direction from context at render time after the CSS-mirror migration. * docs(i18n): use headings for RTL priority tiers, not markdown bold The docsite prose renderer (renderInlineMarkdown) only supports backtick code-spans and [label](href) links -- **bold** renders as literal asterisks. Convert the four contributor priority tiers from fake-bold prose lead-ins into real level-4 headings + prose, which the renderer supports and which gives proper visual hierarchy. Code identifiers stay in the prose (where backticks work), since headings render text verbatim. * docs(i18n): reframe useDirection() JSDoc as a render-time last resort The hook's own doc-comment still told authors to reach for it to 'swap directional icons' -- the exact pattern the Pagination refactor and the updated guide move away from. Reframe it to point at the preferred tools first (logical CSS, rtlStyles.mirror for icons, lazy isRtlElement for behavior) and note the hydration caveat, so IDE hovers and the API surface match the guidance. Comment-only. * docs(i18n): document that the provider does NOT set <html dir> The provider's dir prop feeds context direction only; it never touches the DOM dir attribute. Since astryx components mirror layout and directional icons from the DOM dir (not the context value), an RTL locale won't visually mirror unless the consumer also sets dir on <html> or a wrapping element. Make this explicit where a provider user will look: add the previously-undocumented dir prop to the component doc, a best-practice entry, and expand the dir JSDoc (IDE hover). Docs only.
This was referenced Aug 5, 2026
This branch was successfully deployed
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.
Why
Dialog's
positionprop exposes physicalleft/rightoffsets as consumer-facing API (DialogPosition { top, right, bottom, left }). Part of the RTL migration wanted these to become logical (inset-inline-start/end) so a positioned dialog mirrors under RTL. But silently flippingleft/rightto logical would be a breaking change — a consumer that setleft: 20expecting the visual-left edge would see their dialog jump to the right under RTL. So this ships a proper, non-breaking deprecation path instead of mutating the existing props (the physical→logical migration PR #4564 correspondingly excludes Dialog).What
start/endtoDialogPosition. They map toinset-inline-start/inset-inline-endand mirror under RTL — the preferred, RTL-safe way to anchor a dialog to an inline edge (start = left in LTR, right in RTL).left/rightvia@deprecatedJSDoc. They still work and stay physical (never mirror) for backward-compat; slated for removal in a future major.left/rightgets exactly today's behavior — physical offset,autofallback, no mirroring.startandleft), the logical one wins and the physical is suppressed so they can't fight. Documented on the interface.migrate-dialog-position-to-logical(packages/cli/codemods/transforms/v0.2.1/) rewrites<Dialog position={{left, right}}>→{{start, end}}. It's optional (left/right still work), import-alias/subpath aware, and skips ambiguous cases (a variableposition, orleft/rightalready coexisting withstart/end).Codemod: how to run
The repo's
astryx upgraderunner picks it up for the 0.2.0 → 0.2.1 range via the codemod registry. To run just this transform directly with jscodeshift:npx jscodeshift -t packages/cli/codemods/transforms/v0.2.1/migrate-dialog-position-to-logical.mjs \ --parser=tsx 'src/**/*.{ts,tsx}'Precedence rule
The physical→logical mapping + precedence lives inline in
dynamicStyles.position(StyleX requirescreate()bodies to be inline object literals — it can't analyze a delegated helper). The identical logic is mirrored in the exported pureresolveDialogPositionOffsets()and unit-tested there (mirror mapping, physical stays physical, precedence, non-breaking equivalence).Testing
pnpm --filter @astryxdesign/core typecheck— 0 errorsresolveDialogPositionOffsetscases)pnpm lint— 0 errors;pnpm check:repo— greenSemver note
Changeset is a
feat(patch) — this is additive (start/end) plus a deprecation, with no break. Per the repo's 0.x policy ([breaking]→ minor, everything else → patch), a non-breaking change must be a patch;check:changesetsenforces this. (The task brief said "minor," but minor is the breaking tier here, sofeat/patch is the correct, CI-passing category for a non-breaking change.)Future-major removal plan
Once consumers have adopted
start/end(aided by the codemod), a follow-up major removesleft/rightfromDialogPositionand the physical branch fromdynamicStyles.position, leaving only the logical offsets.