Skip to content

fix(MobileNav): side="auto" resolves the drawer edge in RTL and on first open - #11227

Merged
cixzhang merged 18 commits into
meta:mainfrom
mahmed74:fix/rtl-mobile-sidenav-first-open
Nov 13, 2026
Merged

cixzhang merged 18 commits into
meta:mainfrom
mahmed74:fix/rtl-mobile-sidenav-first-open

Conversation

@mahmed74

@mahmed74 mahmed74 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Phone users in a right-to-left layout see the navigation drawer slide in from the far edge, away from the control that opened it. In Chromium this happened on every open, because the edge check ignored text direction. In a browser that does not focus a tapped button, the first open also fell back to the default end. Every open now resolves from the opener when the opener holds focus or names the drawer in aria-controls. An opener that holds no focus and has no aria-controls still opens from end. This affects MobileNav with the default side="auto", including the AppShell mobile drawer. Reported in #11206.

Problem and solution fit

  • Why it happens: side="auto" picks the drawer's edge from the focused element's position. On the first open nothing may be focused, because a touch tap does not focus a button in every mobile browser. The drawer then keeps its default end, which is the left edge in RTL. The left-half check also ignored text direction, and the edge was set one commit after the open render, so the drawer could cross the screen before settling.
  • Why it harms the task: the drawer enters from the opposite side of the control that opened it, which breaks the start/end relationship to the trigger.
  • Why it matters: RTL users get a mirrored, inconsistent experience on their very first interaction.

The fix resolves the side relative to the text direction, before the first rendered frame. When nothing is focused, it uses the element whose aria-controls names the drawer as the opener. A plain button without aria-controls can't be found this way, so an unfocused first open from it still uses end.

Expected behavior and authority

  • design:bidirectionality DR7: layered surfaces keep their start/end relationship to the trigger.
  • component:MobileNav FR8: side="auto" keeps the drawer's start/end relationship to the element that opened it.

Smallest restoration

In MobileNav.tsx, the side="auto" resolution now:

  1. falls back to the element whose aria-controls names the drawer when no element is focused, matching each token against the dialog's rendered id so a caller id still resolves;
  2. treats the physical left half of the viewport as inline start in LTR and inline end in RTL, using the existing isRtlElement helper;
  3. resolves the edge while rendering the transition to open, or to side="auto" while already open, so the first open frame already has the right edge;
  4. for a drawer already open when it hydrates, defers the focus and layout reads until after hydration (Core's shared useIsHydrating hook), so the server markup is unchanged and there is no hydration mismatch.

No new API, prop, attribute or default. The visible change is the fix: a right-to-left drawer with side="auto" now enters from the opener's side on every open from a focused opener or an aria-controls toggle such as AppShell's. A standalone plain button that takes no focus (for example, the Default story's) still falls back to end.

Evidence

  • Reproduction before the change: in a unit test, an RTL opener at the inline start resolved to end, and a first open with nothing focused resolved to end.
  • Result after the change: both resolve to start.
  • Representative unchanged path: LTR with a focused inline-start opener still resolves to start. The MobileNav and AppShell tests are 18 files and 201 tests at this head: main added two AppShell cases, and the centred-opener commit added two MobileNav cases.
  • Regression test or other mutation-sensitive proof: MobileNavAutoSideRtl.test.tsx (inline-start and inline-end openers in LTR and RTL, nothing focused, caller id, side present in the opening commit, side changing to auto while open) and MobileNavAutoSideSsr.test.tsx (server render, then hydrate with no mismatch, then resolve from the opener). The SSR test fails when the hydration gate is removed. Both SSR cases also assert that the drawer and its panel are never measured; they fail when the focus-inside-dialog guard is removed. __tests__/MobileNavAutoSide.a11y.chromium.spec.ts checks the entrance edge in real Chromium, in LTR and RTL, with the opener in either half of the viewport (from fix(mobile-nav): resolve auto side before opening #11282, with co-author credit).

Real Chrome stills (first open, RTL)

Chrome 157, page set to RTL, light theme. Each frame is the first open after a fresh load, about 90 ms into the slide. Before: main. After: 643aaf3. The head since then changes only how a centred opener resolves, which the AppShell toggle, in the right half, does not reach.

Story Before (first open) After (first open)
AppShell "With Mobile Nav", 390 px Before, AppShell 390 After, AppShell 390

The AppShell toggle sits in the right (inline-start) half of the bar. The drawer's edge, measured every frame:

  • Before: the first frame is at x = −320 to 0, and the drawer slides in from the left edge, away from the toggle. It rests at 0 to 320.
  • After: the first frame is at x = 390 to 710, and the drawer slides in from the right edge, beside the toggle. It rests at 70 to 390.

The MobileNav "Default" story centres its toggle (x 195 of 390). A centred opener opens at the inline end in both directions, so its RTL drawer rests at x 0 to 320, as on main; a unit case pins it.

Scope

Components: MobileNav

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run packages/core/src/MobileNav --project ui

Fixes #11206

…L 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 meta#11206
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 13, 2026 6:02pm UTC

Request Review

@meta-cla

meta-cla Bot commented Nov 11, 2026

Copy link
Copy Markdown

Hi @mahmed74!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@astracat-bot

astracat-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 13, 2026, 6:04 PM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Nov 11, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging into #11206. Requesting changes: right-to-left drawers now settle on the opener's side, but the first-open problem is still there for some openers, and two smaller fixes are needed.

  • The first open still slides in from the far edge when the opener sits in the inline-start half of an RTL page, because the side is set in the Effect after the drawer has already rendered with the default end (in Chromium the drawer starts off-screen left and then jumps to the right edge, while the second open is correct), so please resolve the side before the drawer's first rendered frame and cover the first open's entrance with a browser test.
  • The unfocused fallback compares aria-controls with the internal drawer id (MobileNav.tsx:577-579), so a standalone MobileNav with its own id and an opener that names it still opens from end; please match each aria-controls token against the dialog's rendered id as well and add a test for that case.
  • MobileNav.tsx:584 re-implements isRtlElement from hooks/isRtlElement.ts; please call isRtlElement(trigger) so Core reads direction in one place.

In Chromium the toggle is focused after both a click and a tap, so the focus fallback alone does not explain the reported first open. A shorter comment above the fallback, and a description that says later RTL opens were also on the far side before this change, would help reviewers.

Automated review (maintainer link)

Address review feedback on meta#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.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick follow-up: the first right-to-left open now enters from the opener's side, and the caller id and isRtlElement points are fixed. Requesting changes for two remaining issues:

  • A side="auto" drawer that is already open when server-rendered markup hydrates reads focus and layout in the hydrating render, so React reports an attribute mismatch it does not patch and the drawer stays on the server's inline-end edge with a stale data-side (MobileNav.tsx:559-584); please keep those reads out of the hydrating render (as Timestamp.tsx does with useSyncExternalStore), resolve an already-open drawer after hydration, and add a server-render-then-hydrate test like Drawer.ssr.test.tsx.
  • CI runs ESLint in strict mode, where MobileNav.tsx:573 fails @eslint-react/purity for document.querySelectorAll during render and MobileNavAutoSideRtl.test.tsx:119 fails @typescript-eslint/array-type (use (string | null | undefined)[]).

With this change AppShell's right-to-left drawer opens from the left edge, beside its toggle, on every open, as the MobileNav record's FR8 asks. The comment above the opener lookup and the description's "Later opens are correct" could also be tightened; the inline comments have details.

Automated review (maintainer link)

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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one remaining issue. Thanks for the follow-up: a drawer that is open on the server now hydrates without a mismatch, the strict-lint errors are gone, and right-to-left drawers open beside their opener from the first open in Chromium.

  • MobileNav.tsx:302-304 and :568-572 rebuild the useSyncExternalStore hydration flag that useIsHydrating (packages/core/src/hooks/useIsHydrating.ts) already owns for Drawer, Dialog, BottomSheet and the rest of Core; please use const canReadDom = !useIsHydrating(); and delete the three module constants and the useSyncExternalStore import, which also puts CLOSE_WITHIN_HOLD back under its own JSDoc.

The earlier review pointed to Timestamp.tsx, which keeps its own copy; useIsHydrating is the shared owner. The inline comments suggest shorter wording for two code comments, and the description's "Later opens are correct", "No ... visual change" and test counts are out of date: AppShell's right-to-left drawer now opens from the left edge, beside its toggle, on every open.

Automated review (maintainer link)

…ration 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]>
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 39318a7

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 94ba966

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, so a maintainer needs to add the ci:run label to run it.

Thanks for the follow-ups. Right-to-left side="auto" drawers now open beside their opener from the first open, a drawer that is already open when the page hydrates no longer causes a mismatch, and the shared useIsHydrating hook now gates the read. One optional comment-wording suggestion is inline.

Claims and files checked

Claims

  • The first right-to-left open after a page load slid in from the wrong edge: verified. The base set the edge in an Effect after the opening commit, so showModal() ran with the default end.
  • Later right-to-left opens also landed on the far side, and every open now resolves from the opener: verified (MobileNav.tsx:582-584).
  • The fix affects the default side="auto", including AppShell's drawer: verified (MobileNav.tsx:494).
  • With nothing focused, the drawer kept its default end, which is the left edge in right-to-left: verified (base Effect; drawerEnd uses insetInlineEnd).
  • The left-half check ignored text direction: verified (base Effect).
  • The edge arrived one commit after the open render: verified (base Effect order; the test that reads data-side at showModal()).
  • The fix resolves the edge relative to text direction before the first frame: verified (MobileNav.tsx:557-588).
  • With nothing focused, the element whose aria-controls names the drawer is used, matching each token, so a caller id resolves: verified (MobileNav.tsx:566-578; caller-id test).
  • The fix uses the existing isRtlElement helper: verified (MobileNav.tsx:84, :584).
  • A drawer that is open when it hydrates reads no focus or layout until after hydration, with no mismatch: verified (MobileNav.tsx:560-561, through the shared useIsHydrating; SSR test). The description's Timestamp reference is now this shared hook.
  • No new API, prop, attribute or default: verified (source diff). "No visual change" holds for styling. The right-to-left resting edge does move, and that move is the fix.
  • Before the change, a right-to-left inline-start opener and an unfocused first open resolved to end. After it, both resolve to start, and a focused left-to-right opener is unchanged: verified (base and head code; the new tests).
  • All 14 MobileNav test files pass: the 14 files are confirmed, and CI confirms the run on this head.
  • The SSR test fails without the hydration gate: verified on the earlier revision without the gate.
  • Changeset (core patch: side="auto" opens from the opener's inline edge in right-to-left, including an unfocused first open): verified (MobileNav.tsx:561-588; the new tests).

Files

  • .changeset/mobilenav-auto-side-rtl.md: clear.
  • packages/core/src/MobileNav/MobileNav.tsx: clear, plus one optional comment suggestion (:554-556).
  • packages/core/src/MobileNav/MobileNavAutoSideRtl.test.tsx: clear.
  • packages/core/src/MobileNav/MobileNavAutoSideSsr.test.tsx: clear.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one remaining issue. Right-to-left side="auto" drawers now open beside their opener from the first open, the dialog and its contents stay mounted across opening, and a drawer that is open in the server markup hydrates without a mismatch.

  • Miss: after a drawer that was open in the server markup hydrates, the lookup at MobileNav.tsx:566-570 runs after showModal() has moved focus into the drawer, so it measures the drawer panel instead of the opener and skips the aria-controls fallback; treat focus inside the dialog as no focus, and make the SSR test's showModal() mock move focus into the drawer as MobileNavFocus.test.tsx does, asserting that the side still follows the opener.

Optionally, #11282 has a Chromium spec that checks the entrance edge in LTR and RTL from both halves of the viewport, and adopting it with credit to its author would cover the entrance in a real browser. CI has not run on this head yet; a maintainer adds the ci:run label so it runs.

Claims and files checked

Claims

  • Right-to-left drawers opened on the far side because the edge check ignored text direction: verified from the previous code.
  • With nothing focused, the first open fell back to the default end edge: verified from the previous code.
  • Every open now resolves from the opener: verified for opens in the page; false after a server-open drawer hydrates (the finding above).
  • The default side="auto" is affected, including the AppShell drawer: verified (MobileNav.tsx:494).
  • The edge is set before the first rendered frame: verified (MobileNav.tsx:557-588; the test that reads data-side at showModal()).
  • With nothing focused, the element whose aria-controls names the drawer is the opener, and a caller id resolves: verified (MobileNav.tsx:564-578; the caller-id test).
  • The existing direction helper is used: verified (MobileNav.tsx:584).
  • A drawer open on the server reads no focus or layout while hydrating, with no mismatch: verified (MobileNav.tsx:560-561; the SSR test).
  • No new API, prop, attribute or default: verified.
  • Before the change an inline-start RTL opener and an unfocused first open resolved to end, after it to start, and a focused inline-start LTR opener is unchanged: verified from the previous and new code.
  • The SSR test resolves from the opener after hydration: false outside jsdom, because its showModal() mock does not move focus.
  • The SSR test fails without the hydration gate: consistent with the code.
  • The MobileNav, AppShell and hook suites pass: not verified, since CI has not run on this head.
  • The latest commit changes only code comments: verified.
  • Changeset (core patch: opens from the opener's inline edge in RTL, including the first open after a page load with no focus): verified for opens in the page.

Files

  • .changeset/mobilenav-auto-side-rtl.md: clear.
  • packages/core/src/MobileNav/MobileNav.tsx: the finding above (:560-570); one open comment-wording suggestion (:554-556).
  • packages/core/src/MobileNav/MobileNavAutoSideRtl.test.tsx: clear.
  • packages/core/src/MobileNav/MobileNavAutoSideSsr.test.tsx: its showModal() mock omits the native focus move (part of the finding above).

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 12, 2026 01:35
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 01:36
cixzhang and others added 2 commits November 11, 2026 18:19
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]>
…n 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.
@mahmed74
mahmed74 marked this pull request as ready for review November 13, 2026 11:00
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 120056d

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet.

The ci:run label is already applied, but the workflow runs for this head are waiting for a maintainer to approve them; CI starts once they do.

Thanks for adding the contributor line: the changeset now passes the repository's changeset check, and the change keeps a right-to-left side="auto" drawer beside its opener, the first open included, with unit and SSR tests that fail without the fix.

Non-blocking: the open comment-style threads on MobileNav.tsx and the side-change case's focus setup in MobileNavAutoSideRtl.test.tsx are still worth a pass.

Claims and files checked

Claims:

  • Right-to-left drawers opened from an off-centre opener came in from the far edge on every open in Chromium: verified (base Chromium capture, both halves).
  • With nothing focused the first open fell back to end, and the edge was set one commit after the open: verified (the unfocused and opening-commit cases fail on the base).
  • Every open now resolves from a focused opener or one whose aria-controls names the drawer; a plain unfocused opener still gets end: verified (MobileNav.tsx:566-596).
  • The fallback matches each aria-controls token against the rendered id, so a caller id still resolves: verified (caller-id case).
  • The left half is the inline start in left-to-right and the inline end in right-to-left, and a centred opener opens at the end in both: verified (MobileNav.tsx:590-596, centred cases).
  • The edge is resolved while rendering the open, so the first frame has it: verified (opening-commit case).
  • A drawer open in server markup reads nothing while hydrating and hydrates with no mismatch, and the test fails without the hydration gate: verified (SSR case 1, mutation run).
  • Both SSR cases assert the drawer is never measured and fail without the focus guard: verified (mutation run).
  • No new API, prop, attribute or default: verified (built API surface comparison shows no change).
  • The MobileNav and AppShell tests are 18 files and 201 tests at this head: verified (test run).
  • The Chromium spec checks the entrance edge in both directions from both halves and credits #11282: verified (spec contents, co-author trailers).
  • The stills: the AppShell toggle is in the right half, the drawer rests at x 0–320 before and x 70–390 after, and the product code since the stills changes only how a centred opener resolves: verified (Chromium capture, diff since that commit).
  • The Default story centres its toggle and its right-to-left drawer rests where it does on main: verified (story layout, centred cases).
  • Changeset: MobileNavToggle sets aria-controls, and a custom opener without it that never takes focus still opens from end: verified (MobileNavToggle.tsx:107).
  • Changeset: credits @mahmed74 as its contributor: verified (changeset check passes).

Files:

  • .changeset/mobilenav-auto-side-rtl.md: clear
  • packages/core/src/MobileNav/MobileNav.tsx: non-blocking comment-style notes
  • packages/core/src/MobileNav/MobileNavAutoSideRtl.test.tsx: non-blocking note on the side-change case
  • packages/core/src/MobileNav/MobileNavAutoSideSsr.test.tsx: clear
  • packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 13, 2026 13:20
@cixzhang
cixzhang marked this pull request as ready for review November 13, 2026 13:21
…ent 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]>
@cixzhang
cixzhang marked this pull request as draft November 13, 2026 14:07
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec f61c5b8

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet.

The ci:run label is already applied, but the workflow runs for this head are waiting for a maintainer to approve them; CI starts once they do.

The lint baseline update clears the comment-provenance check that failed on the previous head, and the change keeps a right-to-left side="auto" drawer beside its opener, the first open included, with unit and SSR tests that fail without the fix.

Non-blocking: the open comment-style threads on MobileNav.tsx and the side-change case's focus setup in MobileNavAutoSideRtl.test.tsx are still worth a pass.

Claims and files checked

Claims:

  • Right-to-left drawers opened from an off-centre opener came in from the far edge on every open in Chromium: verified (base Chromium capture, both halves).
  • With nothing focused the first open fell back to end, and the edge was set one commit after the open: verified (the unfocused and opening-commit cases fail on the base; base Chromium probe slides a start-side drawer in from the right).
  • Every open now resolves from a focused opener or one whose aria-controls names the drawer; a plain unfocused opener still gets end: verified (MobileNav.tsx:566-596, Chromium unfocused capture).
  • The fallback matches each aria-controls token against the rendered id, so a caller id still resolves: verified (caller-id case).
  • The left half is the inline start in left-to-right and the inline end in right-to-left, and a centred opener opens at the end in both: verified (MobileNav.tsx:590-596, centred cases).
  • The edge is resolved while rendering the open, so the first frame has it: verified (opening-commit case, Chromium entrance probes).
  • A drawer open in server markup reads nothing while hydrating and hydrates with no mismatch, and the test fails without the hydration gate: verified (SSR case 1, mutation run).
  • Both SSR cases assert the drawer is never measured and fail without the focus guard: verified (mutation run).
  • No new API, prop, attribute or default: verified (built API surface comparison shows no change).
  • The MobileNav and AppShell tests are 18 files and 201 tests, with two AppShell cases from main and two centred-opener cases: verified (test run, history).
  • The Chromium spec checks the entrance edge in both directions from both halves and credits #11282: verified (spec contents, co-author trailers, the four cases reproduced in Chromium).
  • The stills: the AppShell toggle is in the right half, the drawer rests at x 0–320 before and x 70–390 after, and the product code since the stills changes only how a centred opener resolves: verified (Chromium capture, diff since that commit).
  • The Default story centres its toggle and its right-to-left drawer rests where it does on main: verified (story layout, centred cases).
  • Changeset: MobileNavToggle sets aria-controls, a custom opener without it that never takes focus still opens from end, and the entry credits @mahmed74: verified (MobileNavToggle.tsx:107, changeset check passes).

Files:

  • .changeset/mobilenav-auto-side-rtl.md: clear
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • packages/core/src/MobileNav/MobileNav.tsx: non-blocking comment-style notes
  • packages/core/src/MobileNav/MobileNavAutoSideRtl.test.tsx: non-blocking note on the side-change case
  • packages/core/src/MobileNav/MobileNavAutoSideSsr.test.tsx: clear
  • packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 13, 2026 15:39
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 5e862c3

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet.

The ci:run label is already applied, but the workflow runs for this head are waiting for a maintainer to approve them; CI starts once they do.

The merge from main leaves this pull request's own changes untouched, and a right-to-left side="auto" drawer still opens beside its opener, the first open included, with unit and SSR tests that fail without the fix.

Non-blocking: the open comment-style threads on MobileNav.tsx and the side-change case's focus setup in MobileNavAutoSideRtl.test.tsx are still worth a pass.

Claims and files checked
  • Claim: right-to-left drawers opened from an off-centre opener came in from the far edge on every open in Chromium: verified (base Chromium captures, both halves).
  • Claim: with nothing focused the first open fell back to end, and the edge was set one commit after the open: verified (the unfocused and opening-commit cases fail on the base; the base slides a start-side drawer in from the right).
  • Claim: every open now resolves from a focused opener or one whose aria-controls names the drawer, and a plain unfocused opener still gets end: verified (MobileNav.tsx:566-596, Chromium unfocused capture).
  • Claim: the fallback matches each aria-controls token against the rendered id, so a caller id still resolves: verified (caller-id case).
  • Claim: the left half is the inline start in left-to-right and the inline end in right-to-left, and a centred opener opens at the end in both: verified (MobileNav.tsx:590-596, centred cases, direction mutation).
  • Claim: the edge is resolved while rendering the open, so the first frame has it: verified (opening-commit case, Chromium entrance probes).
  • Claim: a drawer open in server markup reads nothing while hydrating, hydrates with no mismatch, and the test fails without the hydration gate: verified (SSR case 1, mutation run).
  • Claim: both SSR cases assert the drawer is never measured and fail without the focus guard: verified (mutation run).
  • Claim: no new API, prop, attribute or default: verified (built API surface comparison shows no change).
  • Claim: the MobileNav and AppShell tests are 18 files and 201 tests: verified (test run).
  • Claim: the Chromium spec checks the entrance edge in both directions from both halves and credits the earlier contribution: verified (spec contents, co-author trailers, its four cases reproduced in Chromium).
  • Claim: in the stills the AppShell toggle is in the right half and the drawer rests at x 0-320 before and x 70-390 after, and the product code since the stills changes only how a centred opener resolves: verified (Chromium capture, diff since that commit).
  • Claim: the Default story centres its toggle and its right-to-left drawer rests where it does on main: verified (story layout, centred cases).
  • Claim (changeset): MobileNavToggle sets aria-controls, a custom opener without it that never takes focus still opens from end, and the entry credits @mahmed74: verified (MobileNavToggle.tsx:107, changeset check passes).
  • File .changeset/mobilenav-auto-side-rtl.md: clear
  • File internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • File packages/core/src/MobileNav/MobileNav.tsx: non-blocking comment-style notes
  • File packages/core/src/MobileNav/MobileNavAutoSideRtl.test.tsx: non-blocking note on the side-change case
  • File packages/core/src/MobileNav/MobileNavAutoSideSsr.test.tsx: clear
  • File packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 56792db

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet.

The ci:run label is already applied, but the workflow runs for this head are waiting for a maintainer to approve them; CI starts once they do.

The merge from main leaves this pull request's own changes untouched, and a right-to-left side="auto" drawer still opens beside its opener, the first open included, with unit and SSR tests that fail without the fix.

Non-blocking: the open comment-style threads on MobileNav.tsx and the side-change case's focus setup in MobileNavAutoSideRtl.test.tsx are still worth a pass.

Claims and files checked
  • Claim: right-to-left drawers opened from an off-centre opener came in from the far edge on every open in Chromium: verified (base Chromium captures, both halves).
  • Claim: with nothing focused the first open fell back to end, and the edge was set one commit after the open: verified (the unfocused and opening-commit cases fail on the base; the base slides a start-side drawer in from the right).
  • Claim: every open now resolves from a focused opener or one whose aria-controls names the drawer, and a plain unfocused opener still gets end: verified (MobileNav.tsx:566-596, Chromium unfocused capture).
  • Claim: the fallback matches each aria-controls token against the rendered id, so a caller id still resolves: verified (caller-id case).
  • Claim: the left half is the inline start in left-to-right and the inline end in right-to-left, and a centred opener opens at the end in both: verified (MobileNav.tsx:590-596, centred cases, direction mutation).
  • Claim: the edge is resolved while rendering the open, so the first frame has it: verified (opening-commit case, Chromium entrance probes).
  • Claim: a drawer open in server markup reads nothing while hydrating, hydrates with no mismatch, and the test fails without the hydration gate: verified (SSR case 1, mutation run).
  • Claim: both SSR cases assert the drawer is never measured and fail without the focus guard: verified (mutation run).
  • Claim: no new API, prop, attribute or default: verified (built API surface comparison shows no change).
  • Claim: the MobileNav and AppShell tests are 18 files and 201 tests: verified (test run).
  • Claim: the Chromium spec checks the entrance edge in both directions from both halves and credits the earlier contribution: verified (spec contents, co-author trailers, its four cases reproduced in Chromium).
  • Claim: in the stills the AppShell toggle is in the right half and the drawer rests at x 0-320 before and x 70-390 after, and the product code since the stills changes only how a centred opener resolves: verified (Chromium capture, diff since that commit).
  • Claim: the Default story centres its toggle and its right-to-left drawer rests where it does on main: verified (story layout, centred cases).
  • Claim (changeset): MobileNavToggle sets aria-controls, a custom opener without it that never takes focus still opens from end, and the entry credits @mahmed74: verified (MobileNavToggle.tsx:107, changeset check passes).
  • File .changeset/mobilenav-auto-side-rtl.md: clear
  • File internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • File packages/core/src/MobileNav/MobileNav.tsx: non-blocking comment-style notes
  • File packages/core/src/MobileNav/MobileNavAutoSideRtl.test.tsx: non-blocking note on the side-change case
  • File packages/core/src/MobileNav/MobileNavAutoSideSsr.test.tsx: clear
  • File packages/core/src/MobileNav/__tests__/MobileNavAutoSide.a11y.chromium.spec.ts: clear

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 13, 2026 18:09
@cixzhang
cixzhang marked this pull request as ready for review November 13, 2026 18:10
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Nov 13, 2026
@cixzhang
cixzhang merged commit 84a446b into meta:main Nov 13, 2026
139 of 141 checks passed
cixzhang added a commit that referenced this pull request Nov 13, 2026

This branch was successfully deployed

1 active deployment
Preview — 56792dba Deployed Nov 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] RTL mobile navbar/sidebar opens in the wrong direction on first attempt

2 participants