Repository navigation
feat(AppShell): responsive mobile nav API (#565) - #644
Merged
Merged
Conversation
New mobileNav prop on XDSAppShell:
- Implicit auto: having topNav/sideNav auto-enables mobile nav at breakpoint
- Config object: { hasToggle, isOpen, onOpenChange, content } for tuning
- ReactNode: full escape hatch, provide your own <XDSMobileNav>
- false: disable mobile nav entirely
New components:
- XDSMobileNavToggle: context-aware hamburger, renders nothing above breakpoint
- XDSAppShellMobileContext: shared state for mobile nav
For SideNav-only layouts with no TopNav, auto-generates a minimal top bar
with hamburger toggle below the breakpoint.
Part of #565
Co-authored-by: Navi <[email protected]>
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsAppShell · View in Storybook · 🆕 XDSAppShellMobileContext
MobileNav · View in Storybook · 🆕 XDSMobileNavToggle
SideNav · View in Storybook · 🆕 XDSSideNavRenderContext
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. XDSSideNav - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
added 13 commits
March 17, 2026 05:04
…text XDSMobileNav now reads open state from XDSAppShellMobileContext when isOpen/onOpenChange props are omitted. This makes it presentational when used inside AppShell — state is managed by the parent. Props still work for standalone use or the ReactNode escape hatch. Also updates shell lab to use the new mobileNav config API: - Mode: Auto / Custom / Disabled (was Auto / Custom / None) - Has Toggle: toggle for auto hamburger visibility - Custom mode uses config object with content instead of raw state Co-authored-by: Navi <[email protected]>
…not deprecated Co-authored-by: Navi <[email protected]>
The collapse toggle doesn't make sense when the SideNav is inside the mobile drawer — there's nothing to collapse to. Now reads from AppShell mobile context and returns null when isMobile is true. Co-authored-by: Navi <[email protected]>
The breakpoint controls when mobile behavior kicks in, not a SideNav visual property. Moved from SideNav section to Mobile Nav section, and only shown when mobile nav is not disabled. Co-authored-by: Navi <[email protected]>
Shell lab now demos four mobile nav modes: - Auto: default behavior, AppShell handles everything - Custom Content: custom drawer with search bar + reordered nav items - Custom Toggle: auto drawer content, toggle placed in content body - Disabled: no mobile nav Custom Content mode shows the config object with content key wrapping an XDSMobileNav (with side selector). Custom Toggle mode uses hasToggle: false and renders XDSMobileNavToggle next to the page title. Co-authored-by: Navi <[email protected]>
New XDSSideNavRenderContext with three modes: - 'default': full sidebar (desktop inline) - 'topbar': heading + footerIcons only, horizontal layout (mobile top bar) - 'drawer': children + topContent + footer only, skip heading/footerIcons When AppShell renders the auto mobile top bar for SideNav-only layouts (no TopNav), it wraps the sideNav slot in topbar mode — the SideNav renders its heading and footer icons horizontally as a top bar, with the hamburger toggle alongside. In the mobile drawer, sideNav renders in drawer mode — just the nav sections and items, since the heading is already shown up top. Co-authored-by: Navi <[email protected]>
Config content is rendered as-is — if you want a drawer, provide <XDSMobileNav> in the content. No magic detection or double wrapping. Co-authored-by: Navi <[email protected]>
New optional header prop on XDSMobileNav. When provided, renders custom content in the header area instead of the title text. The close button always renders alongside. Useful for rendering SideNavHeading, search bars, or other elements in the drawer header. Co-authored-by: Navi <[email protected]>
…drawer composition
Simpler approach: SideNav in drawer mode renders itself inside
<XDSMobileNav header={heading}>, passing its heading directly as the
header prop. No portal mechanism needed.
- MobileNav gets header prop (ReactNode) for custom header content
- SideNav drawer mode wraps itself in MobileNav, passes heading
- AppShell just renders sideNav in drawer context — SideNav handles the rest
- Removed XDSMobileNavHeading portal component and header context
- Fixed topbar layout: footer icons use marginInlineStart auto to stay right
when no heading is present
- Updated tests for new rendering structure
Co-authored-by: Navi <[email protected]>
When the auto mobile top bar has the toggle on the right side, the drawer should slide from the right (end) to match. Co-authored-by: Navi <[email protected]>
No consumers yet — safe to flip the default. End (right in LTR) matches where the toggle sits in the auto mobile top bar. Co-authored-by: Navi <[email protected]>
… 320px - Header height set to 48px (same as TopNav) for visual consistency - Default drawer width bumped from 280px to 320px for more breathing room Co-authored-by: Navi <[email protected]>
Stops scroll chaining from the drawer content into the page behind it. Co-authored-by: Navi <[email protected]>
cixzhang
force-pushed
the
navi/feat/mobile-nav-api
branch
from
March 17, 2026 06:18
f3d8ba8 to
919f725
Compare
Uses a two-phase open/close cycle: - Open: showModal() first, then set visualOpen on next frame to trigger CSS transitions (slide + backdrop fade) - Close: clear visualOpen to start animation, delay dialog.close() by 250ms (10ms for prefers-reduced-motion) so the transition plays The drawer transform and backdrop opacity transitions were already defined in CSS — this change wires the timing so the native dialog lifecycle doesn't kill the close animation. Co-authored-by: Navi <[email protected]>
cixzhang
force-pushed
the
navi/feat/mobile-nav-api
branch
2 times, most recently
from
March 17, 2026 12:49
5f6dd73 to
2c9c4b2
Compare
Keeps the close animation: when isOpen goes false, the CSS transition plays (drawer slides out, backdrop fades) and dialog.close() is delayed 250ms (10ms for prefers-reduced-motion) so the animation completes. Entry animation deferred to a follow-up — needs more investigation with @starting-style and the dialog positioning model. Co-authored-by: Navi <[email protected]>
cixzhang
force-pushed
the
navi/feat/mobile-nav-api
branch
from
March 17, 2026 12:51
2c9c4b2 to
cdd7679
Compare
Drawer is now full viewport width by default, capped at the configured width (320px). On small screens, the drawer fills the screen instead of leaving a gap. Co-authored-by: Navi <[email protected]>
cixzhang
marked this pull request as ready for review
March 17, 2026 13:03
52 of 55 tasks
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New
mobileNavprop onXDSAppShellthat provides progressive mobile navigation, plus a presentational refactor ofXDSMobileNav.API Shape
Usage
New Components
XDSMobileNavToggle— Hamburger button that reads from AppShell context. Renders nothing above the breakpoint. Can be placed anywhere in the tree.XDSAppShellMobileContext— Shared context:{ isMobile, isMobileNavOpen, toggleMobileNav, openMobileNav, closeMobileNav }XDSMobileNav Changes
isOpenandonOpenChangeare now optional. Inside AppShell, state is managed automatically via context. Outside AppShell, provide them as props for standalone use. Both paths are first-class — no deprecation.Shell Lab
Updated config panel with:
contentkey wrapping<XDSMobileNav>Design Decisions
topNavorsideNavauto-enables mobile nav at the breakpointcollapsiblepatternVibe Test Backing
Tested 4 API variants × 8 prompts (32 agents). This design scored 8/8 high confidence and lowest escape hatches (4 total). Won the programmatic-open case decisively — the object form
{ isOpen, onOpenChange }gives controlled state without losing auto behavior.See: #565 (comment)
Still TODO (follow-ups)
Part of #565