Skip to content

feat(AppShell): hiddenRegions hides the top nav or side nav while they stay mounted - #10312

Draft
cixzhang wants to merge 17 commits into
mainfrom
feat/appshell-hidden-regions
Draft

cixzhang wants to merge 17 commits into
mainfrom
feat/appshell-hidden-regions

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #10276 (SideNav collapsedWidth/collapsedVariant), and builds the hide-and-keep part of #3890 by AKnassa and of the Focus Mode spec in #8410 by humbertovirtudes on AppShell. Both are credited as co-authors and in the changeset. Owner decision, Nov 6 2026: hidden regions live on the shell, as one controlled list, so the shell can play the nav's slide and the content's reflow as one motion.

User impact

An app can now hide its top nav, its side nav, or both, for example for a focus mode, and bring them back exactly as they were:

<AppShell hiddenRegions={isFocusMode ? ['topNav', 'sideNav'] : undefined} …>
  • The content takes the freed space. The nav slides out by its edge as the content moves into its place, on one clock, so the content never jumps ahead of or behind the nav.
  • A hidden nav stays mounted: open groups, its scroll position and SideNav's rail state come back unchanged. Once it has slid out, it pauses: its effects stop (on React 19.2 and later), and they run again when it comes back.
  • A keyboard or screen-reader user can't reach a hidden nav: it is inert. If focus was inside it, focus moves to the main content instead of falling to the page.
  • On a phone, the drawer leaves out each hidden region, and its menu button goes when nothing is left to show. A region that hides while the drawer is open closes it, and revealing the region doesn't reopen it. If the button that opened the drawer is gone, focus goes to main.
  • With the section variant, the side nav's divider goes with it.
  • Apps that don't pass hiddenRegions are unchanged.

Public delta

  • AppShellProps.hiddenRegions?: ReadonlyArray<'topNav' | 'sideNav'>. Exactly those two values; the banner and content can't be hidden. At runtime an unknown entry is ignored with a development warning. No other API change.

Change

  • AppShell.tsx:
    • A hidden side nav keeps its panel mounted at width 0 and inert, without its section divider.
    • A hidden top nav keeps its row in the header at height 0 and inert. With no banner, the header drops its banner landmark.
    • The region's edge and the content's glide play through the shared edge reveal, measured before the commit and played after it, on one clock.
    • Focus inside a hiding region moves to main.
    • Each hidden region's content sits in an Activity boundary that turns hidden once the region's edge motion ends (at once when none plays) and visible again in the commit that reveals it, before the reveal plays. On React without Activity, a hidden region stays mounted and its effects run. The boundary lives in appShellActivity.tsx, which AppShell and TopNav share.
    • On a phone, the drawer toggle and drawer content follow the side nav. The mobile context reports the drawer closed and disabled while it has nothing to show. Hiding never writes mobileNav.isOpen or calls onOpenChange.
  • Phone paths:
    • A hidden side nav stays mounted, hidden and inert, inside the top nav's drawer. The drawer keeps one subtree whichever region hides, so the side nav keeps its state.
    • While a region is hidden, a drawer with nothing left to show reads as closed and disabled, and its menu button goes. What counts: the side nav, the top nav's own items (read from its props during render, with no Effect or state), or the app's own mobileNav.content. A shell that hides nothing keeps its drawer exactly as before.
    • A hidden top nav gives the drawer no heading.
    • TopNav pauses its own drawer items in Activity while the top nav is hidden.
    • TopNav shows its menu button and opens its drawer, during render, only for what is still visible: its own items unless hidden, and the side nav unless hidden. This also covers a TopNav the app wraps in its own component, which AppShell can't read. FR19 states that AppShell counts such a slot as bringing drawer items, so useAppShellMobile() keeps reporting the drawer as enabled there.
    • With only the top nav hidden, the side nav's bar keeps the banner landmark.
  • MobileNav.tsx: an opener that is still connected but hidden (inert) counts as gone, and focus moves to main; a plain <main> with no tab stop gets one until focus leaves it. Inside AppShell, a menu button removed because the drawer has nothing left to show counts as gone too, and focus moves to this shell's main (an internal context, not the document's first main).
  • Records:
    • AppShell FR19–FR21 (Specs' wording), a Public concepts row, verification rows, Owns and Does-not-own lines, DEC-2 (the spec:AST-002 FR4 admission note and the Implementation note), and the Compatibility line.
    • The MobileNav FR6 amendment, and TopNav FR5 and FR6 clauses deferring to AppShell FR19.
  • Stories Core/AppShell "Focus Mode" and "Hidden Side Nav Section"; docs; [feat] changeset.

Test plan

  • Red first: on main, 20 of the 32 new hiddenRegions jsdom cases fail and all pass here; the cases that pass on main hold trivially there, because main has no hiddenRegions. The MobileNav hidden-opener cases also fail on main.
  • Hides-nothing matrix (phone): hiddenRegions omitted or empty × a heading-only top nav, a top nav with items, app drawer content, and no navigation. It checks the drawer's enabled state and toggle count, and passes on main and here, so the hidden-state logic can't change the default shell.
  • Phone cases, one per path: revealing a region hidden while the drawer was open keeps the drawer closed (uncontrolled and controlled, with onOpenChange never called); a wrapped heading-only top nav with only the side nav hidden shows no menu button; the drawer keeps the hidden side nav's state; a drawer with nothing left reads as closed and its toggle goes; focus reaches main when the drawer closes because its side nav hid; and the banner landmark stays when only the top nav hides.
  • AppShellHiddenRegionScroll.a11y.chromium.spec.ts (pr-a11y): on the Focus Mode story at 1280×200, where the side nav scrolls and hiding the top nav grows the side column, a side nav scrolled to 74 px, hidden until it pauses and shown again comes back at 74 px. The offsets are read before the commit that hides the region changes the DOM, so the column's growth cannot clamp them.
  • AppShell, TopNav and MobileNav suites: 517 passed in 24 files at this head. tsc is clean, and lint, pnpm check:knowledge, pnpm check:changesets and pnpm check:component-import-boundaries pass.
  • Real browser: the exact-head preview check follows. It covers Focus Mode on and off at desktop and phone, mid-slide frames with the nav edge and the content edge together, focus moving to main, and the section divider.

Writing rubric results

R1 narration: none; FR19–FR21, DEC-2 and the MobileNav FR6 amendment state the behavior in the present tense.
R2 research: none in the records.
R3 evidence: FR19–FR21 cite the owner decision and spec:AST-002, spec:AST-105 and MobileNav; verification rows name tests and stories, with no pull request.
R4 rejected alternatives: the Does-not-own list states scope, not history.
R5 change references: none.
R6 open questions: none added.

Size

  • First-load JavaScript (architecture:component-import-boundaries INV10), measured with the size report's esbuild build (.github/scripts/lib/component-size.js options), gzip, base = merge base. For a page that renders AppShell without hiddenRegions: AppShell alone +3.04 KB, AppShell + SideNav +1.21 KB, AppShell + TopNav + SideNav +1.37 KB. The docs, form, menu and table reference pages are unchanged (+0.01, 0, 0, 0 KB). AppShell no longer imports TopNav: it reads the top nav's drawer items through TopNav/topNavDrawerItems.ts, which TopNav registers in (about 1.3 KB less on pages without TopNav). The rest is the hidden-region code itself, which is over INV10's 0.3 KB; how it loads is being decided before the next revision.

  • vs main: 20 files, +1575/−157. Product lines 911 across 14 files (AppShell.tsx 450, TopNav.tsx 95, MobileNav.tsx 50, motion/scrollOffsets.ts 41, motion/transientCopy.ts 40, appShellDrawerFocus.ts 33, appShellActivity.tsx 33, the TopNavMobileContentContext.ts change 30, the doc 14, records 123, the comment-provenance baseline 2); the rest is tests, the stories and the changeset (821).

  • Review rounds since CodeBunny approved the shape: TopNav's hidden-region flags ride the existing internal TopNavMobileContentContext (the separate TopNav shell context is gone); the drawer-focus context is a shared context; component:AppShell names appShellDrawerFocus.ts in its ownership; AppShell's and MobileNav's latest-value refs use Core's internal useCommittedRef; the AppShell FR20 verification row names MobileNavFocus.test.tsx; a hidden region now pauses in Activity once its exit motion ends, as DEC-2's implementation note states, with the Activity wrapper moved to appShellActivity.tsx (named in component:AppShell's ownership).

  • The product size is about what CodeBunny approved at cc51d1c with no size finding, and the owner's API approval covers the shape. Two changes in these rounds touch hiddenRegions: the TopNavMobileContentContext.ts doc comment that names it, and the Activity pause of a hidden region, which brings the code to DEC-2's recorded note. Splitting would reopen a reviewed, approved shape without benefit to anyone using AppShell.

Owner and land path

…y stay mounted

A hidden region takes no space, goes inert and keeps its state. Focus
inside it moves to main. The region's edge and the content's change in
space play as one motion through the shared edge reveal, which measures
both before the commit and plays both on one clock after it. On a phone
the drawer and its toggle follow 'sideNav', and a drawer with nothing to
show reads as closed without writing the app's open state. The section
variant's side nav divider goes with the hidden side nav. MobileNav
moves focus to main when the button that opened it is hidden. Records:
AppShell FR19-FR21, a Public concepts row and verification rows, and the
MobileNav FR6 amendment. Stories: Focus Mode and the section variant.

Co-authored-by: AK <[email protected]>
Co-authored-by: Humberto Virtudes <[email protected]>
@vercel

vercel Bot commented Nov 6, 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 14, 2026 8:47am UTC

Request Review

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

astracat-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 21, 2026, 2:50 PM UTC

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 2733c69

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 6, 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.

Changes requested. hiddenRegions works as described on desktop, where both regions slide out with the content on one clock and go inert, but four phone paths don't yet match the AppShell records.

  • On a phone, hiding the nav that fills an open drawer removes the menu button instead of hiding it (MobileNavToggle renders nothing once mobile navigation is disabled), so MobileNav's new hidden-opener branch never runs and focus ends in the closed drawer or on the page body instead of main (FR20).
  • On a phone with a top nav, hiding the side nav unmounts its drawer copy and hiding the top nav swaps the whole drawer subtree, so the side nav's state resets after a hide and show (FR19).
  • With a top nav that has no drawer items of its own, hiding the side nav removes the drawer while useAppShellMobile() still reports it open and enabled, so an app's own MobileNavToggle stays expanded for a drawer that is gone (FR19).
  • Hiding only the top nav on a phone leaves the visible side-nav top bar without a banner landmark, because the bar checks headerContent == null while the hidden header still exists (FR3).
  • The changeset's "keep their state" and "MobileNav moves focus to main when the button that opened it is hidden" don't hold inside AppShell on a phone until the points above are fixed.

A phone-width AppShell test for each path (drawer open, then hide) would pin the fixes. The inline comments point at the lines involved.

[Automated review]

Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
…focus to main

- A hidden side nav stays mounted, hidden and inert, inside the top nav's
  drawer, and the drawer no longer swaps its subtree when the top nav
  hides, so the side nav keeps its state on a phone.
- TopNav reports whether it has drawer items of its own, so a drawer
  with only a hidden side nav reads as closed and disabled.
- When the drawer closes because it has nothing left to show, its menu
  button is gone, and MobileNav moves focus to this shell's main.
- With only the top nav hidden, the side nav's bar keeps the banner
  landmark.

Co-authored-by: AK <[email protected]>
Co-authored-by: Humberto Virtudes <[email protected]>
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec ab61fbc

@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.

Changes requested. The phone gaps from the last round are fixed: a hidden side nav keeps its drawer state, an empty drawer reads closed, focus reaches this shell's main, and the banner landmark stays. Four things still need work:

  • With a TopNav that has only a heading and no side nav, a shell that passes no hiddenRegions now treats its drawer as empty, so a mobileNav.content drawer and the app's own MobileNavToggle stop rendering and useAppShellMobile() reports navigation disabled, against AppShell FR11 and FR12 (count content as drawer content and apply the empty-drawer test only while a region is hidden).
  • TopNav reports its items to AppShell from a layout effect into state that starts at true, so the first render, and the server HTML, show a menu toggle for an empty drawer that goes only after hydration; derive whether the top nav has drawer items during render instead.
  • With only the top nav hidden on a phone, the drawer is still headed by the hidden top nav's heading because TopNav passes header={heading} whatever its hidden state, while FR19 keeps a hidden top nav out of the drawer.
  • Miss: hiding both navs also drops a mobileNav.content drawer that still has content to show (FR12), which the first fix covers.

CI has not run on this head yet. The inline comments point at the lines involved.

[Automated review]

Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/TopNav/TopNav.tsx Resolved
Comment thread packages/core/src/TopNav/TopNav.tsx Resolved
…idden

A shell that hid nothing, with a heading-only TopNav and the app's own
drawer content, lost its drawer and toggle. The empty-drawer rule now
applies only while a listed region is hidden, and counts the app's own
drawer content. Whether the top nav has drawer items of its own is read
from its props during render, with no Effect or state, so the server
HTML matches. A hidden top nav gives the drawer no heading. A test
matrix pins the drawer of a shell that hides nothing; it passes on main
too.

Co-authored-by: AK <[email protected]>
Co-authored-by: Humberto Virtudes <[email protected]>
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec b8ddd89

@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.

Changes requested. hiddenRegions works as described on desktop and leaves shells that hide nothing unchanged, but four things still need work:

  • When an app wraps a heading-only TopNav in its own component and hides only the side nav, topNavHasDrawerItems counts the wrapper as having items, so on a phone the menu button stays and opens an empty drawer while useAppShellMobile() reports it open and enabled, against AppShell FR19.
  • Miss: when a region hides while the phone drawer is open, the drawer closes as FR20 says, but revealing the region reopens it and moves focus into it because AppShell keeps its stored open state, against FR20's "Revealing a region does not move focus"; clear AppShell's own open state when the drawer empties and say in the record what a controlled drawer does on reveal.
  • Miss: TopNav FR5 and FR6 still say the drawer is headed by heading, shows a divider whenever items and side nav content are both present, and keeps the toggle while AppShell passes side nav content, which no longer holds for hidden regions, so add a clause deferring to AppShell FR19 and give the MobileNav FR6 amendment the removed-opener case the code handles.
  • Miss: the changeset, the prop's JSDoc and both doc descriptions say the phone drawer and its toggle follow 'sideNav', but with a top nav that has items hiding the side nav keeps the toggle and with only a top nav hiding 'topNav' removes it, so describe it as the drawer leaving out each hidden region and its toggle going when nothing is left.

CI has not run on this head yet. The inline comments point at the lines involved.

[Automated review]

Comment thread packages/core/src/TopNav/TopNav.tsx Resolved
A TopNav wrapped in the app's own component is not one AppShell can
read, so with only the side nav hidden its menu button stayed and opened
an empty drawer. TopNav now shows its menu button and opens its drawer,
during render, only for its own items unless hidden and the side nav
unless hidden. A drawer with nothing visible closes, and focus goes to
main. FR19 states what AppShell reports for a slot that is not a TopNav
element.

Co-authored-by: AK <[email protected]>
Co-authored-by: Humberto Virtudes <[email protected]>
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 6, 2026
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec b5f3bab

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 6, 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.

Changes requested. The wrapped TopNav menu button from the last round is fixed, and shells that hide nothing still render exactly as on main, but three things still need work:

  • When a region hides while the phone drawer is open, revealing it reopens the drawer and moves focus into it because AppShell keeps its stored open state (AppShell.tsx:727-728), against FR20's "Revealing a region does not move focus", and with a heading-only TopNav wrapped in the app's own component the same state leaves useAppShellMobile() reporting the drawer open (an app's own MobileNavToggle reads expanded) while TopNav holds it closed, against FR19; clear the stored state when the drawer empties and say in FR19 and FR20 what a controlled drawer and a top nav slot AppShell cannot read report.
  • TopNav FR5 and FR6 still say the drawer is headed by heading, shows a divider whenever items and side nav content are both present, and keeps the toggle while AppShell passes side nav content, which no longer holds for hidden regions, so add a clause deferring to AppShell FR19 and give the MobileNav FR6 amendment the removed-opener case the code handles.
  • The changeset, the prop's JSDoc and both doc descriptions say the phone drawer and its toggle follow 'sideNav', but with a top nav that has items hiding the side nav keeps the toggle and with only a top nav hiding 'topNav' removes it, so describe it as the drawer leaving out each hidden region and its toggle going when nothing is left.

CI has not run on this head yet. The inline comments point at the lines involved.

[Automated review]

Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
Comment thread packages/core/src/TopNav/TopNav.tsx Resolved
Comment thread .changeset/appshell-hidden-regions.md Resolved
Outside AppShell, when the button that opened the drawer is hidden,
MobileNav focused the page's first main with a plain focus(). A <main>
without tabindex cannot take it, so focus fell to the page, against FR6.
It now focuses main through focusForLastInputTemporarily, which gives a
plain <main> a tab stop until focus leaves it.

Test: a standalone MobileNav with a plain <main> and a hidden opener; focus
lands on main. It fails before this change.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 264f871

@cixzhang

Copy link
Copy Markdown
Contributor Author

Decision: D-20261113-306

Records the owner's direction to keep the list ("We just keep the list") at 264f871, where AppShell's hidden mobile regions pause and keep their scroll (AppShell FR19), and MobileNav returns focus to main when its opener is hidden, now also outside AppShell (MobileNav FR6). It waives nothing.

@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.

Changes requested: one fix remains, in the pull request description.

  • The Test plan still describes the revision before last: it reports 484 passing tests where the AppShell, TopNav and MobileNav suites run 485, names the browser scroll spec as the check that fails on the previous revision where the new plain-<main> MobileNav case is the one that fails there, and says the previous revision brought the side nav back at 26 px where it brings it back at 74 px.

The AppShell, TopNav and MobileNav record changes are approved for this head, and the code checks out: shells that omit hiddenRegions render as before, and a hidden side nav comes back at its scroll position. Non-blocking: two comment-style suggestions in AppShell.tsx remain open, spec:AST-105 FR9's adopter list does not name AppShell's hidden regions, and the description's Records list leaves out the architecture:react-component-runtime paragraph.

Claims and files checked

Claims:

  • Changeset: AppShell takes a list that hides its top nav or side nav while they stay mounted: verified (the prop in AppShell.tsx; the API generator's one row).
  • Changeset: a hidden region takes no space, is inert, keeps its state, and focus inside it moves to main: verified (the hiddenRegions tests; two zero-size inert regions in Chromium).
  • Changeset: the region slides out by its edge as the content takes its space, in one motion: verified (mid-motion, all four running animations share one progress and main has the same share of travel left on both axes).
  • Changeset: on a phone the drawer leaves out hidden regions and its menu button goes when nothing is left: verified (phone tests; no menu button in Chromium).
  • Changeset: a region that hides while the drawer is open closes it, and revealing it does not reopen it: verified (phone tests, uncontrolled and controlled).
  • Changeset: MobileNav moves focus to main when its opener is hidden: verified (both hidden-opener tests, the plain-main one failing on the previous revision).
  • Changeset: patch release with the co-authors credited: verified (frontmatter, the AppShell compatibility line).
  • Description, user impact: content takes the freed space on one clock, a hidden nav keeps its state and scroll and pauses after it slides out, it is inert, the phone drawer rules, the section divider goes, and shells without the prop are unchanged: verified (tests; Chromium scroll 74 to 74; divider frame; identical default frames).
  • Description, public delta: one new prop, and an unknown entry is ignored with a warning: verified.
  • Description, change list for AppShell, TopNav, MobileNav and the phone paths: verified against the code.
  • Description, records list: verified; it leaves out the runtime-architecture paragraph (narrower, non-blocking).
  • Description, stories, docs and changeset: verified.
  • Description, red-first: 20 of 32 new AppShell cases and the MobileNav hidden-opener case fail on main: verified.
  • Description, the previous revision passes every jsdom case and fails only the browser scroll spec: false (the new plain-main case fails there; the scroll check holds there).
  • Description, hides-nothing matrix and the per-path phone cases pass: verified.
  • Description, the browser scroll spec keeps 74 px: verified; that the previous revision returned 26 px: false (it returns 74 px).
  • Description, 484 tests pass in the three suites: false (485).
  • Description, typecheck, lint, the knowledge check and the changeset check pass: verified.
  • Description, a preview check follows: a future step, not checked.
  • Description, size figures (20 files, +1575/−157, 911 product lines over 14 files, 821 other): verified.
  • Description, review-round list: verified against the code and records.

Files:

  • .changeset/appshell-hidden-regions.md: clear.
  • apps/storybook/stories/AppShell.stories.tsx: clear.
  • docs/architecture/react-component-runtime.md: clear.
  • docs/specs/components/AppShell/AppShell.spec.md: clear.
  • docs/specs/components/MobileNav/MobileNav.spec.md: clear.
  • docs/specs/components/TopNav/TopNav.spec.md: clear.
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear (baseline check passes).
  • packages/core/src/AppShell/AppShell.doc.mjs: clear.
  • packages/core/src/AppShell/AppShell.test.tsx: clear.
  • packages/core/src/AppShell/AppShell.tsx: two non-blocking comment-style suggestions (lines 752-754 and 1392-1393).
  • packages/core/src/AppShell/__tests__/AppShellHiddenRegionScroll.a11y.chromium.spec.ts: clear.
  • packages/core/src/AppShell/appShellActivity.tsx: clear.
  • packages/core/src/AppShell/appShellDrawerFocus.ts: clear.
  • packages/core/src/MobileNav/MobileNav.tsx: clear.
  • packages/core/src/MobileNav/MobileNavFocus.test.tsx: clear.
  • packages/core/src/TopNav/TopNav.slotPresence.test.tsx: clear.
  • packages/core/src/TopNav/TopNav.tsx: clear.
  • packages/core/src/TopNav/TopNavMobileContentContext.ts: clear.
  • packages/core/src/motion/scrollOffsets.ts: clear.
  • packages/core/src/motion/transientCopy.ts: 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.

Approved pending CI: CI's jobs were skipped on this draft head, so CI has not run on it yet.

An engineering owner approved the AppShell, TopNav, MobileNav and runtime record changes for this exact head, and the code matches them: the corrected Test plan reproduces here, a scrolled side nav comes back at 74 px after focus mode in Chromium, and shells that omit hiddenRegions render the same frames as main. Optional touch-ups, none required:

  • Two new comments in AppShell.tsx (lines 752-754 and 1392-1393) could become short active sentences, as the open inline suggestions show.
  • spec:AST-105 FR9 lists every edge-reveal adopter in Core, and AppShell's hidden regions now use that reveal without a line there.
  • The description's Records list could name the paragraph added to architecture:react-component-runtime.
Claims and files checked

Claims (changeset and description), each verified at this head:

  • New optional prop hides the top nav or side nav while they stay mounted: verified (AppShell.tsx:371, :1126-1142, :1428-1438; state-kept test).
  • A hidden region takes no space, is inert, keeps its state, and focus inside it moves to main: verified (AppShell.tsx:381-399; inert, state and focus tests; Chromium: regions 1280×0 and 0×560).
  • The region slides out by its edge with the content, in one motion: verified (AppShell.tsx:1316-1336; Chromium: four animations at one progress, main at the same fraction of travel on both axes, reversal mid-motion runs back together).
  • On a phone the drawer leaves out hidden regions and its menu button goes when nothing is left: verified (AppShell.tsx:772-776, TopNav.tsx:265-267; phone tests; Chromium phone: menu button 1 to 0).
  • Hiding while the drawer is open closes it, and revealing does not reopen it: verified (uncontrolled and controlled tests, no open-change call).
  • MobileNav moves focus to main when its opener is hidden, a plain main included: verified (MobileNav.tsx:403-418; both hidden-opener tests, red on the base branch).
  • A hidden nav keeps open groups, scroll and rail state, and pauses once slid out on React 19.2 and later: verified (state and effect-log tests; Chromium: 74 px, 0 while paused, 74 px after the reveal).
  • With the section variant the divider goes with the side nav: verified (AppShell.tsx:385; Chromium frame).
  • Apps that omit the prop are unchanged: verified (six default-shell frames pixel-identical to the base branch; hides-nothing matrix passes on both).
  • Public delta is one prop with exactly two values, an unknown entry warned in development, no other API change: verified (API generator: one row; AppShell.tsx:733-741; warning test).
  • Change list (zero-size inert panel and row, banner rule, edge reveal measured before and played after the commit, focus handoff, shared Activity module, phone drawer paths, TopNav gating including a wrapped TopNav, MobileNav hidden and removed opener): verified against the source and its tests.
  • Records list: verified; it leaves out the runtime-record paragraph the diff also adds.
  • Red-first results (20 of 32 new cases and both hidden-opener cases fail on the base branch; only the plain-main case fails on the previous revision): verified by re-running both.
  • Browser scroll check at 1280×200 brings the side nav back at 74 px: verified with the same steps in Chromium.
  • 485 tests pass; typecheck, lint, knowledge and changeset checks pass: verified.
  • Size figures (20 files, +1575/−157, 911 product lines over 14 files): verified.
  • Review-round list and co-author credit: verified (diff, commit trailers, changeset).
  • Writing rubric results (present tense, no research, evidence cited, no change references, no open questions added): verified against the record diffs.
  • The real-browser preview check that "follows": a forward statement, not checkable; the Chromium checks above cover its scenarios.

Files:

  • .changeset/appshell-hidden-regions.md: clear
  • apps/storybook/stories/AppShell.stories.tsx: clear
  • docs/architecture/react-component-runtime.md: clear
  • docs/specs/components/AppShell/AppShell.spec.md: clear
  • docs/specs/components/MobileNav/MobileNav.spec.md: clear
  • docs/specs/components/TopNav/TopNav.spec.md: clear
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • packages/core/src/AppShell/AppShell.doc.mjs: clear
  • packages/core/src/AppShell/AppShell.test.tsx: clear
  • packages/core/src/AppShell/AppShell.tsx: two optional comment rewrites
  • packages/core/src/AppShell/__tests__/AppShellHiddenRegionScroll.a11y.chromium.spec.ts: clear
  • packages/core/src/AppShell/appShellActivity.tsx: clear
  • packages/core/src/AppShell/appShellDrawerFocus.ts: clear
  • packages/core/src/MobileNav/MobileNav.tsx: clear
  • packages/core/src/MobileNav/MobileNavFocus.test.tsx: clear
  • packages/core/src/TopNav/TopNav.slotPresence.test.tsx: clear
  • packages/core/src/TopNav/TopNav.tsx: clear
  • packages/core/src/TopNav/TopNavMobileContentContext.ts: clear
  • packages/core/src/motion/scrollOffsets.ts: clear
  • packages/core/src/motion/transientCopy.ts: clear

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 4b46c2e

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 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.

Changes requested. An engineering owner approved the AppShell, TopNav, MobileNav and runtime record changes for this exact head, and the hidden-region behavior holds in tests and in Chromium; two things need fixing:

  • Newly live check: hiddenRegions adds about 1.2 KB gzip of first-load JavaScript to a page that renders AppShell with TopNav and SideNav without using it (2.5 KB with SideNav only, 4.3 KB for AppShell alone, because AppShell.tsx now imports TopNav.tsx), over the 0.3 KB that architecture:component-import-boundaries INV10 allows, so move the hidden-region code behind its own import or a deferred load and report the per-page deltas, or have an engineering owner amend INV10.
  • Regression: after the merge of main, the Test plan's "485 passed at this head" is 515 in 24 files, and its "previous head" result now points at a revision where that case passes, so update both.

Optional touch-ups: the two comment rewrites in AppShell.tsx from the open inline suggestions, a line for AppShell in spec:AST-105 FR9's adopter list, and the runtime-record paragraph in the description's Records list. CI has not run on this draft head.

Claims and files checked

Claims (changeset and description), at this head:

  • A new optional prop hides the top nav, the side nav or both while they stay mounted: verified (state test; Chromium).
  • A hidden region takes no space, is inert and keeps its state, and focus inside it moves to main: verified (inert, state and focus tests; Chromium regions 1280×0 and 0×560).
  • The region slides out by its edge with the content, in one motion: verified (Chromium: four animations at one progress, main partway through its travel).
  • On a phone the drawer leaves out hidden regions and its menu button goes when nothing is left: verified (phone tests; Chromium menu buttons 1 to 0).
  • Hiding while the drawer is open closes it, and revealing does not reopen it: verified (uncontrolled and controlled tests).
  • MobileNav moves focus to main when its opener is hidden, a plain main included: verified (both hidden-opener tests, red on the base branch).
  • A hidden nav keeps open groups, scroll and rail state, and pauses once slid out on React 19.2 and later: verified (state and effect tests; Chromium 74 px, 0 while paused, 74 px after the reveal).
  • With the section variant the divider goes with the side nav: verified (Chromium frame).
  • Apps that omit the prop are unchanged: verified for behavior and rendering (default frames identical to the base branch; hides-nothing matrix); they do load the feature's code (first finding).
  • The public delta is one prop with exactly two values, an unknown entry warned in development: verified (API generator: one row).
  • Change list (zero-size inert panel and row, banner rule, edge reveal, focus handoff, shared Activity module, phone drawer paths, TopNav gating, MobileNav hidden and removed opener): verified against the source and its tests.
  • Records list: verified; it leaves out the runtime-record paragraph.
  • Red first on the base branch (20 of 32 new cases and both hidden-opener cases fail): verified.
  • Previous-head result (only the plain-main case fails): false at this head; the revision before this merge carries the same patch and passes that case.
  • Hides-nothing matrix passes on the base branch and here: verified.
  • Browser scroll check brings the side nav back at 74 px: verified with the same steps in Chromium.
  • 485 tests pass: false (515 in 24 files at this head); typecheck, lint, knowledge and changeset checks pass: verified.
  • Size figures (20 files, +1575/−157, 911 product lines over 14 files): verified.
  • Review-round list, co-author credit and writing rubric results: verified.
  • Land path waits for the shared-file pull request: it has merged, and this head is the one merge of the base branch after it.
  • The real-browser preview check that "follows": a forward statement, not checkable.

Files:

  • .changeset/appshell-hidden-regions.md: clear
  • apps/storybook/stories/AppShell.stories.tsx: clear
  • docs/architecture/react-component-runtime.md: clear
  • docs/specs/components/AppShell/AppShell.spec.md: clear
  • docs/specs/components/MobileNav/MobileNav.spec.md: clear
  • docs/specs/components/TopNav/TopNav.spec.md: clear
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • packages/core/src/AppShell/AppShell.doc.mjs: clear
  • packages/core/src/AppShell/AppShell.test.tsx: clear
  • packages/core/src/AppShell/AppShell.tsx: first-load cost (first finding); two optional comment rewrites
  • packages/core/src/AppShell/__tests__/AppShellHiddenRegionScroll.a11y.chromium.spec.ts: clear
  • packages/core/src/AppShell/appShellActivity.tsx: clear
  • packages/core/src/AppShell/appShellDrawerFocus.ts: clear
  • packages/core/src/MobileNav/MobileNav.tsx: clear
  • packages/core/src/MobileNav/MobileNavFocus.test.tsx: clear
  • packages/core/src/TopNav/TopNav.slotPresence.test.tsx: clear
  • packages/core/src/TopNav/TopNav.tsx: first-load cost (first finding)
  • packages/core/src/TopNav/TopNavMobileContentContext.ts: clear
  • packages/core/src/motion/scrollOffsets.ts: clear
  • packages/core/src/motion/transientCopy.ts: clear

Automated review (maintainer link)

Comment thread packages/core/src/AppShell/AppShell.tsx Resolved
… TopNav

AppShell imported TopNav only to tell whether a top nav has items of its
own for the phone drawer. That check moves to a small module that TopNav
registers itself in, so a page with AppShell and no TopNav loads no TopNav
code (about 1.3 KB gzip less first-load JavaScript). No behavior change.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@cixzhang cixzhang added lane:1 Astryx fix-loop lane 1 owns this and removed needs:design-review Affects visuals — Design should review labels Nov 20, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 8e71aef

@github-actions github-actions Bot added needs:design-review Affects visuals — Design should review and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 21, 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.

Changes requested: an engineering owner approved the AppShell, TopNav, MobileNav and runtime-record changes for this head, and the hidden-region behavior holds in tests and in Chromium, but these blocking findings need fixing:

  • TopNav/topNavDrawerItems.ts keeps TopNav's type in a module-local WeakSet, so scripts/shared-identity.test.mjs fails and a swizzled TopNav is not recognised by AppShell; keep the set under a versioned shared key from utils/sharedRealm, one slot per React, as spec:AST-110 FR3 asks.
  • TopNav/topNavDrawerItems.ts is a new internal module that AppShell.tsx imports and no record names, so add it to a record with its usage, why it is needed and why TopNavMobileContentContext is not enough, for an owner decision.
  • Newly live check: hiddenRegions adds about 1.3 KB gzip of first-load JavaScript to a page that renders AppShell with TopNav and SideNav without using it (3.0 KB for AppShell alone), over the 0.3 KB that architecture:component-import-boundaries INV10 allows, so move the hidden-region code behind its own import or a deferred load, or have an engineering owner amend INV10.
  • The description's Size section says 20 files, +1575/−157 and 911 product lines over 14 files, while this head changes 21 files, +1609/−157, with 945 product lines over 15 files, so update the counts and the comparison with the earlier approved head.

The branch now conflicts with main in AppShell.tsx, TopNav.tsx, AppShell.spec.md, TopNav.spec.md and MobileNav.spec.md, and the head that resolves it needs an engineering owner's /approve-spec <full head SHA> again, which the author may give as an engineering owner. Optional touch-ups: drop the unused isValidElement import in TopNav.tsx, take the open comment suggestions, and add AppShell to the edge-reveal adopters in spec:AST-105 FR9. CI has not run on this draft head.

Claims and files checked

Review mode: same-head; reason: none

Changed rules (0): none

Claims (changeset and description), at this head:

  • A new optional prop hides the top nav, the side nav or both while they stay mounted: verified (state test; Chromium).
  • A hidden region takes no space, is inert and keeps its state, and focus inside it moves to main: verified (inert, state and focus tests; Chromium regions 1280×0 and 0×560, focus on the content button).
  • The region slides out by its edge with the content, in one motion: verified (Chromium halfway through the 300 ms slide: region and content edges both at 12.02 px on the side and 2.22 px on top).
  • On a phone the drawer leaves out hidden regions and its menu button goes when nothing is left: verified (phone tests; Chromium menu buttons 1 to 0).
  • Hiding while the drawer is open closes it, and revealing does not reopen it: verified (uncontrolled and controlled tests).
  • MobileNav moves focus to main when its opener is hidden, a plain main included: verified (both hidden-opener tests, red on the base branch).
  • A hidden nav keeps open groups, scroll and rail state, and pauses once slid out: verified (state and effect tests; Chromium 74 px, 0 while paused, 74 px after the reveal).
  • With the section variant the divider goes with the side nav: verified (Chromium frame of the section story).
  • Apps that omit the prop are unchanged: verified for behavior and rendering (default frames identical to the base branch at 1280 and 390 px; hides-nothing cases); they do load the feature's code (INV10 finding).
  • The public delta is one prop with exactly two values, an unknown entry warned in development: verified (API generator: one row; development-only warning).
  • AppShell no longer imports TopNav and reads its drawer items through the new module, about 1.3 KB less without TopNav: verified (imports; 1.31 KB less than the previous revision for AppShell alone).
  • Change list (zero-size inert panel and row, banner rule, edge reveal, focus handoff, shared Activity module, phone drawer paths, TopNav gating, MobileNav hidden and removed opener): verified against the source and its tests.
  • Records list: verified; it leaves out the runtime-record paragraph.
  • Red first on the base branch, the hides-nothing cases, and the browser scroll check at 74 px: verified.
  • 517 tests pass in 24 files; typecheck, lint, knowledge, changeset and import-boundary checks pass: verified.
  • First-load figures (+3.04, +1.21, +1.37 KB; reference pages unchanged): verified within 0.05 KB (3.04, 1.23, 1.32 KB; reference pages 0).
  • File and line counts in the Size section: false at this head (21 files, +1609/−157; 945 product lines over 15 files).
  • Product size about what was approved at the earlier approved head: not supported by line counts (666 product lines over 10 files there, 945 here).
  • Review-round list, co-author credit and writing rubric results: verified.
  • The real-browser preview check that "follows": a forward statement, not checkable.
  • Land path waits on another pull request, then one merge of the base branch: that pull request has merged; the branch now needs that merge, as it conflicts in five files.

Files:

  • .changeset/appshell-hidden-regions.md: clear
  • apps/storybook/stories/AppShell.stories.tsx: clear
  • docs/architecture/react-component-runtime.md: owner-approved at this head
  • docs/specs/components/AppShell/AppShell.spec.md: owner-approved at this head; conflicts with main
  • docs/specs/components/MobileNav/MobileNav.spec.md: owner-approved at this head; conflicts with main
  • docs/specs/components/TopNav/TopNav.spec.md: owner-approved at this head; conflicts with main
  • internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear
  • packages/core/src/AppShell/AppShell.doc.mjs: clear
  • packages/core/src/AppShell/AppShell.test.tsx: clear
  • packages/core/src/AppShell/AppShell.tsx: first-load cost; two optional comment rewrites; conflicts with main
  • packages/core/src/AppShell/__tests__/AppShellHiddenRegionScroll.a11y.chromium.spec.ts: clear
  • packages/core/src/AppShell/appShellActivity.tsx: clear (named by an approved record)
  • packages/core/src/AppShell/appShellDrawerFocus.ts: clear (named by an approved record)
  • packages/core/src/MobileNav/MobileNav.tsx: clear
  • packages/core/src/MobileNav/MobileNavFocus.test.tsx: clear
  • packages/core/src/TopNav/TopNav.slotPresence.test.tsx: clear
  • packages/core/src/TopNav/TopNav.tsx: first-load cost; unused import; conflicts with main
  • packages/core/src/TopNav/TopNavMobileContentContext.ts: clear
  • packages/core/src/TopNav/topNavDrawerItems.ts: module-local registry; no naming record
  • packages/core/src/motion/scrollOffsets.ts: clear (named by an approved record)
  • packages/core/src/motion/transientCopy.ts: clear

Automated review (maintainer link)


// TopNav adds itself when its module loads, so a TopNav element can only
// exist once its type is here.
const topNavTypes = new WeakSet<object>();

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.

topNavTypes is module-local, so a swizzled TopNav registers in its own copy's set and the package AppShell counts it as an unknown slot (with only the side nav hidden, useAppShellMobile() keeps reporting an empty drawer as enabled). scripts/shared-identity.test.mjs fails on it at this head (spec:AST-110 FR3). Keeping the set under a versioned key from utils/sharedRealm, one slot per React as utils/sharedContext.ts does with realmValue(sharedKey(...)), fixes both.

AppShell.tsx imports this module from outside TopNav/, so a record also needs to name it, with its usage and why TopNavMobileContentContext is not enough (architecture:knowledge-contracts DEC-22).

This branch was successfully deployed

1 active deployment
Preview — 8e71aef2 Deployed Nov 14, 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. lane:1 Astryx fix-loop lane 1 owns this needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants