Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for tracking this down: the auto side now follows the trigger in right-to-left layouts, and the reported first open (RTL, toggle in the left half) slides in correctly. A few changes are needed before this can merge:
- The first open still slides in from the wrong edge whenever
side="auto"resolves tostart: the dialog is already rendered with the oldendclasses when the layout effect measures the trigger (MobileNav.tsx:577), so in Chromium an RTL toggle in the right half sweeps the drawer in from the left edge, and an LTR toggle in the left half slides it leftward from inside the viewport. - The direction check at
MobileNav.tsx:579-583re-implementsisRtlElement(packages/core/src/hooks/isRtlElement.ts), and itsclosest('[dir="rtl"]')and<html dir>fallbacks override the trigger's computed direction, so a toggle inside adir="ltr"region of an RTL page opens the drawer on the far side; please callisRtlElement(trigger)and setdirectionon the trigger in the test instead. - The changeset says the auto side now resolves before the first open, but the test checks only
data-sideatshowModal(), and its LTR case (a right-half trigger expectingend) already passes onmain; once the first point is fixed, make that case a left-half trigger expectingstartand add a browser check of where the entrance starts.
If the drawer stays unrendered on an opening until its side is resolved, its first computed style already carries that side, which should settle the first and third points together. CI has not run on this head yet; a maintainer needs to add the ci:run label.
|
Addressed the requested MobileNav changes in |
|
I checked the requested changes against the current head The follow-up now:
Local verification:
The remaining |
There was a problem hiding this comment.
Thanks for the quick follow-up: the shared isRtlElement check, the four-case matrix and the Chromium entrance test address the earlier review, and keeping the drawer out of the measuring commit fixes the first slide. One part of the new approach needs to change before this can merge:
- Rendering
nullwhile the side resolves (MobileNav.tsx:719-721) replaces the<dialog>on every default-side open, so the unmount-only effect (MobileNav.tsx:659-668) checks a stale or missing node, and an open drawer that unmounts is no longer closed and no longer returns focus to its opener; by this code path the existingcloses the dialog when unmounted while fully opentest leaves the dialog open. - A reopen before the delayed close fires removes the still-open dialog, so the replacement records the page body as its opener (
MobileNav.tsx:605-611) and the next close leaves focus on the body instead of the toggle. - Every default-side open remounts the drawer's content, so an expanded or collapsed SideNav group and any typed text reset between opens, which they do not on
main. - The Testing section reports results from the earlier commit (two cases for the new test, which now has four, and a run that includes the unmount test above), so please rerun at the final head and update it.
Keeping the dialog mounted and withholding only its open styling (styles.open) on an opening whose side is still unresolved keeps the correct first slide without replacing the node; default-side tests for an unmount while open, a reopen mid-close and content state across a reopen would pin it. CI has not run on this head yet; a maintainer needs to add the ci:run label.
Claims and files checked
- Changeset, the auto side is resolved before the first open: verified (
MobileNav.tsx:567-592,:602,:719-721). - Changeset, the auto side respects RTL inline direction: verified (
MobileNav.tsx:580-584). - Description, the side resolves in a layout effect before
showModal()can run: verified (MobileNav.tsx:567,:602). - Description, the modal waits for the auto-side resolution: verified, and it applies to every auto open (
MobileNav.tsx:568-571,:719-721). - Description, the physical position maps to logical start or end by direction: verified; the code uses the opener's computed direction (
MobileNav.tsx:580). - Description, a regression test records the side at
showModal()for LTR and RTL: verified (MobileNav.test.tsx:334-407, four cases). - Description, a patch changeset is added: verified.
- Description, on the base the first open could use the stale side: verified from the base source.
- Description, the existing entry-animation tests cover both edges: present (
MobileNavEntryAnimation.test.tsx:189-203); not run here. - Description, the new test passed with two cases: false at this head, which has four cases.
- Description, 48 tests passed across three files including the close edge cases: false at this head by code path (
MobileNavCloseEdgeCases.test.tsx:175). - Description, typecheck, lint, changeset and pre-commit checks passed: not verified; could not be run here.
- Author comment, auto-side dialogs stay unmounted through every unresolved open commit: verified (
MobileNav.tsx:719-721). - Author comment, 25 unit tests and four Chromium cases passed: not verified; could not be run here.
.changeset/mobile-nav-auto-side-before-open.md: clear.packages/core/src/MobileNav/MobileNav.tsx: findings 1-3.packages/core/src/MobileNav/MobileNav.test.tsx: clear for what it covers; no default-side case for the unmount, reopen or content-state paths.packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear; it checks the entrance origin only.
6fc4b62 to
7af5542
Compare
|
Addressed the latest review on 7af5542. The auto-side opening path now keeps the existing dialog mounted. While the trigger is being measured, it withholds only the dialog open styling; once the layout effect resolves the side, the normal open effect shows the same node. That keeps unmount cleanup, focus restoration, the delayed close, mid-close reopen, and stateful navigation content on one dialog instance. The direction branch now uses the shared isRtlElement(trigger) helper. I also added coverage for:
Verification:
The PR body is updated to match the final implementation and test results. |
A drawer open in the server markup resolves its edge after hydration. By then showModal() may have moved focus into the drawer, so the lookup measured the drawer panel instead of the opener and skipped the aria-controls fallback. Focus inside the dialog now counts as no focus. The SSR test starts from focus on the drawer panel, measured away from the opener, and asserts the edge still follows the opener through its aria-controls. The Chromium entrance-edge spec (LTR and RTL, opener in either half) is adopted from meta#11282, scoped to MobileNav paths. Co-authored-by: mahmed74 <[email protected]> Co-authored-by: Josh <[email protected]>
The spec checks in real Chromium that the drawer enters from the edge beside its opener, in LTR and RTL, with the opener in either half of the viewport. A branch merge had dropped it; it returns unchanged, from meta#11282. Co-authored-by: Josh <[email protected]> Co-authored-by: mahmed74 <[email protected]>
There was a problem hiding this comment.
Thanks for the quick turnaround. Keeping the dialog mounted fixes the three problems from the last review, and the shared isRtlElement check, the four-case matrix and the Chromium entrance test cover what the earlier reviews asked for. One change is still needed before this can merge:
- Withholding
styles.openwhile the side resolves (MobileNav.tsx:732) leaves AppShell's drawer, which always uses the default side, atdisplay: nonein the commit that opens it; AppShell's spec requires an open to be visible in the commit that carries it, and the existing testshows a controlled open in the same commit, not one effect later(MobileNavCloseEdgeCases.test.tsx:628) fails on this path.
That gate was the last review's own suggestion, and it missed this requirement. Keeping the dialog displayed and holding only the drawer panel (display: none on the panel until the side resolves) keeps the correct first slide, as long as a reopen during a pending close skips the hold. CI has not run on this head yet; a maintainer needs to add the ci:run label.
Claims and files checked
- Changeset, the auto side is resolved before the first open: verified (
MobileNav.tsx:567-592,:602,:732). - Changeset, the auto side respects RTL inline direction: verified (
MobileNav.tsx:580-584). - Description, on main the first slide could start from the wrong edge because the measured side rendered after
showModal(): verified from main's source. - Description, later opens reused the resolved side: verified (the side state persists between opens).
- Description, the side resolves in a layout effect before the open effect can call
showModal(): verified (MobileNav.tsx:567,:602). - Description, the dialog stays mounted and only its open styling is withheld: verified (
MobileNav.tsx:715,:732); this is what hides AppShell's drawer for one commit. - Description, the dialog node, focus return, delayed close and content state are preserved: verified by code path (
MobileNav.tsx:605-613,:659-668) and the new tests (MobileNavTouchPresentation.test.tsx:265-305); no default-side focus test. - Description, the shared
isRtlElementhelper maps position to logical start or end: verified (MobileNav.tsx:87,:580). - Description, a four-case matrix plus reopen, content-state and unmount tests: verified present (
MobileNav.test.tsx:334-407,MobileNavTouchPresentation.test.tsx:265-305). - Description, a Chromium test reads the entrance transform in four cases: verified present; not run.
- Description, a patch changeset is added: verified.
- Description, 36 tests passed across three files: the count matches (25, 10 and 1); not run; the run leaves out
MobileNavCloseEdgeCases.test.tsx, whose same-commit test fails on this path. - Description, typecheck, lint, Storybook build, the four Chromium cases and pre-commit checks passed: not verified.
.changeset/mobile-nav-auto-side-before-open.md: clear.packages/core/src/MobileNav/MobileNav.tsx: the finding above.packages/core/src/MobileNav/MobileNav.test.tsx: clear.packages/core/src/MobileNav/MobileNavTouchPresentation.test.tsx: clear.packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear; it covers focused openers only.
7af5542 to
e5a035c
Compare
|
Addressed the final visibility review in e5a035c.
Verification: MobileNav close-edge, touch-presentation, entry-animation, reopen, MobileNav, and AppShell suites pass (65 targeted tests); repository pre-commit checks pass. The Chromium entrance cases and |
There was a problem hiding this comment.
Changes requested: the right-to-left mapping and the first-open slide now follow MobileNav's spec, and the earlier remount, focus-return and same-commit visibility problems are fixed, but three small fixes remain.
- The drawer panel's pending state reads
dialogRef.current?.openduring render (MobileNav.tsx:722-723), but rendered output has to come from props, state and context, so resetautoSideResolvedwhere the dialog actually closes (the close timer and the unmount teardown) instead of on every close, and drop the read. - A reopen during a pending close now slides the drawer back in with no touch input hold (
MobileNav.tsx:620-626), so a tap on the backdrop during that slide closes it again; take the entrance hold after theif (!dialog.open)block, as before. - The description says the dialog's open styling is withheld while the side resolves, but the dialog now stays displayed and only the drawer panel is hidden, so please update that line.
The three new setAutoSideResolved calls also need lint reasons, because CI runs that lint rule as an error. CI has not run on this head yet; it waits for a maintainer. #11227 changes the same lines for the same issue, so whichever lands second will need a rebase.
Claims and files checked
- Claim: the auto side resolves in a layout effect before
showModal()runs: verified (MobileNav.tsx:574-609). - Claim: the dialog stays mounted while the side resolves: verified (the dialog always renders).
- Claim: only the dialog's open styling is withheld while the side resolves: false (the dialog keeps it at
MobileNav.tsx:740; the drawer panel is hidden at:767). - Claim: the opener's position maps to logical start or end with the shared right-to-left helper: verified (
MobileNav.tsx:587-591). - Claim: a four-case direction and position unit matrix, plus tests for a mid-close reopen, content state and unmount cleanup: verified (
MobileNav.test.tsx:334-407,MobileNavTouchPresentation.test.tsx:265-301). - Claim: a Chromium test reads the drawer's computed transform during the entrance: verified (
MobileNavAutoSide.a11y.chromium.spec.ts:421-428). - Claim: the evidence table's four direction and position results: verified against
MobileNav.tsx:590. - Claim: the first open could slide from the wrong edge because
showModal()ran before the measurement, and later opens reused the side: verified against the base code. - Claim: the listed test, typecheck, lint, Storybook and browser runs passed: not checked; these are the author's own runs.
- Changeset: an auto side resolves before the first open and follows right-to-left direction: verified (
MobileNav.tsx:574-609,:587-591). .changeset/mobile-nav-auto-side-before-open.md: clear.packages/core/src/MobileNav/MobileNav.tsx: the findings above.packages/core/src/MobileNav/MobileNav.test.tsx: clear.packages/core/src/MobileNav/MobileNavTouchPresentation.test.tsx: clear; no test asserts a held reopen.packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear.
|
Addressed the latest review findings in
Verification: 4 focused files, 41 tests passed; repository pre-commit checks passed. The engineering-owner/spec approval request remains unchanged; this update resolves the implementation findings. |
There was a problem hiding this comment.
Changes requested: the right-to-left mapping, the first-open slide and the reopen touch hold now follow MobileNav's spec, and the earlier render-time read, lint and description issues are fixed, but one small fix remains.
- The close timer and the unmount teardown now reset
autoSideResolvedfor everyside(MobileNav.tsx:632,:674), so aside="start"or"end"drawer reopened after a close waits for the layout effect's measurement-freesetAutoSideResolved(true)(:595-596) beforeshowModal()runs, which keeps a value render can derive in Effect-set state; deriveconst isSideResolved = side !== 'auto' || autoSideResolved;, gate the open effect on it, and drop that fixed-branch call.
The four-case Chromium entrance test is a useful guard for the first-slide fix. CI has not run on this head yet; it waits for a maintainer. #11227 changes the same lines for the same issue, so whichever lands second will need a rebase.
Claims and files checked
- Claim: the auto side resolves in a layout effect before
showModal()runs: verified (MobileNav.tsx:574-608). - Claim: the dialog stays mounted and displayed while only the drawer panel waits: verified (
MobileNav.tsx:741,:768). - Claim: the dialog node, focus restoration, delayed close and content state are preserved: verified (
MobileNavTouchPresentation.test.tsx:266-302). - Claim: the flag resets only after the dialog actually closes, including unmount teardown: verified (
MobileNav.tsx:632,:674); it resets for every side, which is the finding above. - Claim: a reopened entrance holds pointer input while keys and assistive technology stay live: verified (
MobileNav.tsx:620-625,MobileNavTouchPresentation.test.tsx:255). - Claim: the opener's position maps to logical start or end with the shared right-to-left helper: verified (
MobileNav.tsx:584-587). - Claim: a four-case direction and position matrix, plus reopen, content-state and unmount tests: verified (
MobileNav.test.tsx:334-407,MobileNavTouchPresentation.test.tsx:242-302). - Claim: a Chromium test reads the drawer's computed transform during the entrance: verified (
MobileNavAutoSide.a11y.chromium.spec.ts:77-88). - Claim: the evidence table's four direction and position results: verified against
MobileNav.tsx:587. - Claim: the first open slid from the wrong edge because
showModal()ran before the measurement, and later opens reused the side: verified against the base code. - Claim: the listed test, typecheck, lint, Storybook and browser runs passed: not checked; these are the author's own runs.
- Changeset: an auto side resolves before the first open and follows right-to-left direction: verified (
MobileNav.tsx:574-598,:584-587). .changeset/mobile-nav-auto-side-before-open.md: clear.packages/core/src/MobileNav/MobileNav.tsx: the finding above; one comment-style suggestion inline.packages/core/src/MobileNav/MobileNav.test.tsx: clear.packages/core/src/MobileNav/MobileNavTouchPresentation.test.tsx: clear.packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear.
| // The dialog stays visible as soon as an open is committed. On the first | ||
| // `side="auto"` render the panel waits one layout pass for its edge to be | ||
| // measured, so AppShell does not inherit a hidden dialog while the drawer | ||
| // is still resolving its placement. |
There was a problem hiding this comment.
Non-blocking (comment style): the panel waits on every auto open that follows a completed close, not only the first, and the second sentence runs 33 words. Suggested:
// The panel stays hidden until the auto side is measured, so the entrance
// starts from the measured edge. The dialog stays displayed, so AppShell
// shows the open in the commit that carries it.|
Addressed the latest review in
Verification: MobileNav-focused suite 54/54 passed; targeted ESLint and Prettier passed; repository pre-commit checks passed. The remaining |
There was a problem hiding this comment.
Changes requested: the right-to-left mapping and the first-open slide now work in a real right-to-left layout (checked in Chromium), and the fixed-side reopen from the last review is fixed, but two small fixes remain.
- Switching
sidefrom"start"or"end"to"auto"while a close is pending now restarts the close delay, becauseisSideResolved(MobileNav.tsx:566) sits in the open/close effect's dependencies (:650) and is false for a fixed side after its first completed close; gating the effect onisOpen && side === 'auto' && !autoSideResolvedinstead keeps the close within 250 ms and keeps every existing MobileNav and AppShell test passing. - Miss: the Chromium spec's right-to-left cases set
diron#storybook-root(MobileNavAutoSide.a11y.chromium.spec.ts:55-56), but Storybook's decorator keeps the story wrapper atdir="ltr", so the dialog stays left-to-right and those cases pass only on the mirrored transform; opening the story with&globals=direction:rtland dropping the rootdirand the opener's inlinedirectionrenders a real right-to-left dialog, and all four cases pass that way.
The first point comes from the derivation the last review suggested, which missed this case; holding the side the opening render saw (usePresentationHold({isOpen, presentation: side}), with the flag starting at false) also covers a fixed-to-auto switch while open or before the first open. CI has not run on this head yet; it waits for a maintainer. #11227 changes the same lines for the same issue, so whichever lands second will need a rebase.
Claims and files checked
- Claim: the auto side resolves in a layout effect before
showModal(): verified (MobileNav.tsx:575-607; the direction matrix passes, and fails on the base in three of four cases). - Claim: the dialog stays mounted and displayed while only the drawer panel waits: verified (
:740,:767; the AppShell same-commit test passes). - Claim: the dialog node, focus restoration, delayed close and content state are preserved: verified (
MobileNavTouchPresentation.test.tsx:266-302), except the delayed close on a fixed-to-auto switch (first point above). - Claim: the flag resets only after the dialog closes, including unmount teardown: verified (
MobileNav.tsx:631,:673). - Claim: a reopened entrance holds pointer input while keys and assistive technology stay live: verified (
:619-624,MobileNavTouchPresentation.test.tsx:255). - Claim: the opener's position maps to logical start or end with the shared right-to-left helper: verified (
MobileNav.tsx:585-589). - Claim: a four-case direction matrix plus reopen, content-state and unmount tests: verified (run, all passing).
- Claim: the Chromium test checks the physical entrance origin: true for its left-to-right cases, false for its right-to-left cases (second point above).
- Claim: the evidence table's four direction and position results: verified in a right-to-left Storybook layout in Chromium.
- Claim: the listed unit, typecheck, lint, Storybook build and browser runs pass: reproduced; the pre-commit run was not repeated.
- Claim: fixed
start/endsides no longer wait for the auto-side state after a close: verified (MobileNavCloseEdgeCases.test.tsx:226). - Changeset: an auto side resolves before the first open and follows right-to-left direction: verified for a focused opener.
.changeset/mobile-nav-auto-side-before-open.md: clear.packages/core/src/MobileNav/MobileNav.tsx: first point above; two comment-style notes.packages/core/src/MobileNav/MobileNav.test.tsx: clear.packages/core/src/MobileNav/MobileNavCloseEdgeCases.test.tsx: clear; the new reopen test also passes on the previous head.packages/core/src/MobileNav/MobileNavTouchPresentation.test.tsx: clear.packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: second point above.
| releaseHoldRef.current = null; | ||
| }; | ||
| }, [isOpen, releasePresentation]); | ||
| }, [isOpen, isSideResolved, releasePresentation]); |
There was a problem hiding this comment.
isSideResolved brings side into this effect's dependencies. A fixed-side drawer's first completed close sets autoSideResolved to false (line 631), and nothing sets it back for a fixed side, so a later switch from "start" or "end" to "auto" during a pending close flips this value: the cleanup clears the close timer and the close branch arms a fresh full delay. In a unit test the dialog is still open 300 ms after the request, past MobileNav FR5's 250 ms, where the base and the previous head have closed it. The comment above the layout effect and the "does not restart the pending close when the side prop changes" test guard exactly this.
Gating on a value that is false whenever isOpen is false keeps side out of a pending close:
const isAutoSidePending = isOpen && side === 'auto' && !autoSideResolved;
// ...
if (isOpen && !isAutoSidePending) {
// ...
}, [isAutoSidePending, isOpen, releasePresentation]);With that edit the MobileNav and AppShell suites still pass. This corrects the derivation the last review suggested, which missed the fixed-to-auto case.
| const root = document.getElementById('storybook-root'); | ||
| root?.setAttribute('dir', nextDirection); | ||
| Object.assign(element.style, { | ||
| direction: nextDirection, |
There was a problem hiding this comment.
Storybook's decorator wraps every story in <div dir={direction}>, ltr unless the direction global is rtl, so dir on #storybook-root does not reach the dialog: its computed direction stays ltr in both "rtl" cases. They pass only because the drawer's transform uses :is([dir="rtl"] *), which matches the root, while its inset follows the wrapper; at 80 px the drawer rests on the right edge and starts mid-screen (x 364, translateX −316).
Opening the story in a real right-to-left layout fixes it, and all four cases pass that way:
await page.goto(
`${storybook.origin}/iframe.html?id=core-mobilenav--default&viewMode=story${direction === 'rtl' ? '&globals=direction:rtl' : ''}`,
);Then drop the root dir write and the opener's inline direction, and assert getComputedStyle(dialog).direction so the setup cannot drift again.
…rst open (#11227) * fix(MobileNav): side="auto" opens from the opener's inline edge in RTL and on first open With side="auto", the drawer edge came from the focused element's physical position, so in RTL an opener at the inline start resolved to the far side. When nothing was focused (a touch tap does not focus a button in every mobile browser), the first open kept the default "end", which is the left edge in RTL; later opens worked because focus had returned to the toggle. Resolve the side relative to the text direction, and fall back to the element that controls the drawer (via aria-controls) when nothing is focused. Fixes #11206 * fix(MobileNav): resolve side="auto" before the first open frame Address review feedback on #11227. - Resolve the auto side while rendering the closed-to-open transition instead of in an Effect, so the first open frame already has the right edge rather than rendering on `end` and jumping. - Match the unfocused fallback's `aria-controls` tokens against the dialog's rendered id (`dialogId`, `dialogRef.current.id`, or a caller `id`), so a standalone MobileNav with its own id resolves correctly. - Read direction through `isRtlElement` instead of re-implementing it. - Shorten the focus-fallback comment. - Add tests for a caller-supplied id and for the side being set in the commit that opens the drawer. * fix(MobileNav): resolve side="auto" after hydration, not during it An already-open side="auto" drawer ran the render-time opener lookup in the hydrating render, reading focus and layout the server never saw. That could pick a different side than the server markup and cause a hydration mismatch. - Gate the closed-to-open side resolution on a useSyncExternalStore flag (false on the server and while hydrating, true after), as Timestamp does. A drawer open at hydration keeps the server's default edge for that render and resolves from the opener in the next one. - Suppress @eslint-react/purity on the aria-controls lookup with a justification: it now runs only on the closed-to-open render, never on the server or while hydrating, and an Effect would commit the default edge first. - Add MobileNavAutoSideSsr.test.tsx: server-render then hydrate in RTL with no hydration error, and the opener-resolved side afterwards. - Use (string | null | undefined)[] in MobileNavAutoSideRtl.test.tsx (@typescript-eslint/array-type). - Tighten the opener-lookup comment. * Merge main into fix/rtl-mobile-sidenav-first-open; use the shared hydration hook MobileNav reads the hydrating render through Core's useIsHydrating instead of its own useSyncExternalStore copy, and two comments are shorter. Co-authored-by: mahmed74 <[email protected]> * feedback * fix(MobileNav): focus inside the drawer is not the side="auto" opener A drawer open in the server markup resolves its edge after hydration. By then showModal() may have moved focus into the drawer, so the lookup measured the drawer panel instead of the opener and skipped the aria-controls fallback. Focus inside the dialog now counts as no focus. The SSR test starts from focus on the drawer panel, measured away from the opener, and asserts the edge still follows the opener through its aria-controls. The Chromium entrance-edge spec (LTR and RTL, opener in either half) is adopted from #11282, scoped to MobileNav paths. Co-authored-by: mahmed74 <[email protected]> Co-authored-by: Josh <[email protected]> * fix(MobileNav): resolve side="auto" from the opener when a server-open drawer hydrates For a drawer open in the server markup, showModal() moves focus into the dialog before the post-hydration render resolves the edge. The drawer itself was then taken as the opener, so the side was measured from the drawer instead of the toggle. Treat focus inside the dialog as no focus, so the aria-controls fallback finds the real toggle. Tests: the SSR test's showModal() mock now moves focus into the dialog like the native method, and a new case covers an unfocused toggle whose aria-controls names the drawer. * Merge branch 'fix/rtl-mobile-sidenav-first-open' of https://github.com/mahmed74/astryx into fix/rtl-mobile-sidenav-first-open * feedback * latest feedback * test(MobileNav): restore the Chromium entrance-edge spec for side="auto" The spec checks in real Chromium that the drawer enters from the edge beside its opener, in LTR and RTL, with the opener in either half of the viewport. A branch merge had dropped it; it returns unchanged, from #11282. Co-authored-by: Josh <[email protected]> Co-authored-by: mahmed74 <[email protected]> * test(MobileNav): the entrance-edge spec sets RTL through the Storybook global and checks where the drawer settles The RTL cases set dir only on #storybook-root, inside which the Storybook decorator lays the drawer out LTR, so they passed with the drawer on the far side. The spec now loads each case with the direction global and also checks that the settled drawer sits in its opener's half of the viewport. In real Chromium all four cases pass on this branch; on main three fail. Co-authored-by: Josh <[email protected]> Co-authored-by: mahmed74 <[email protected]> * Merge branch 'main' into fix/rtl-mobile-sidenav-first-open * fix(MobileNav): a centred opener keeps side="auto" mirrored in RTL The auto side counted an opener at the exact centre as the right half in both directions, so a centred toggle opened the drawer on the right edge in LTR and in RTL. The check now tests the inline-start half for the opener's direction, so a centred opener opens at the inline end in both: the right edge in LTR and the left edge in RTL. A unit case covers a centred opener in each direction. Co-authored-by: ahmed-technyx <[email protected]> * ci feedback * chore(lint): the comment-provenance baseline drops the MobileNav comment this change removed MobileNav.tsx now has one fewer comment that cites an issue, so the no-comment-provenance baseline lists two of those sites instead of three, as the baseline script writes it. Co-authored-by: ahmed-technyx <[email protected]> * Merge branch 'main' into fix/rtl-mobile-sidenav-first-open * Merge branch 'main' into fix/rtl-mobile-sidenav-first-open Co-authored-by: Cindy Zhang <[email protected]>
Primary intent
Fix #11206 by making MobileNav resolve an auto side before its first modal open and by respecting RTL inline direction.
User or maintainer impact
On a fresh load, an RTL MobileNav using
side="auto"could start its first slide from the wrong edge becauseshowModal()ran before the trigger-position measurement completed. Later opens reused the resolved state, which made the bug look intermittent.Change
showModal().isRtlElement()helper.@astryxdesign/core.Evidence
The browser proof reads the drawer's computed transform during the entrance, so it checks the physical origin rather than only the final
data-sideattribute. A static screenshot would not establish which transform was used on the first frame.Scope
Components: MobileNav auto-side resolution and first/reopened entrance presentation
No other issue from the surrounding mobile navigation area is claimed here.
Testing
pnpm exec vitest run --project ui packages/core/src/MobileNav/MobileNav.test.tsx packages/core/src/MobileNav/MobileNavReopen.test.tsx packages/core/src/MobileNav/MobileNavTouchPresentation.test.tsx packages/core/src/MobileNav/MobileNavRootScrollClaim.test.tsx— 41 passed.pnpm -F @astryxdesign/core typecheck— passed.pnpm exec eslint packages/core/src/MobileNav/MobileNav.tsx packages/core/src/MobileNav/MobileNavTouchPresentation.test.tsx— passed.pnpm storybook:build— completed successfully.pnpm exec playwright test packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts --config playwright.config.ts --project chromium— 4 passed.Closes #11206.