Skip to content

fix(MobileNav): the drawer is never wider than 85% of the viewport - #8063

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c14-mobilenav-width
Oct 25, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c14-mobilenav-width

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

User impact

On a phone narrower than the drawer, MobileNav covered the whole screen: the default 320 px drawer on a 320 px phone left no backdrop to tap, although the width prop promises "Capped at 85vw to prevent overflow on small screens". The page the drawer navigates was hidden entirely.

Problem and solution fit

The drawer's width was width: 100vw; max-width: <width>px, which is min(100vw, width): the only cap was the viewport itself. A drawer that covers the screen hides its context and takes away the usual way out, a tap beside it; UIKit's overlay sidebar never covers the whole screen. Small phones, zoomed-in text and split-screen windows reach these widths.

The fix swaps the two: width: <width>px; max-width: 85vw, which is min(width, 85vw). On a 320 px phone the drawer is 272 px wide, and a 48 px strip of the dimmed page stays beside it as a target for the tap that closes it.

Expected behavior and authority

  • MobileNav.doc.mjs, width: "Drawer width in pixels. Capped at 85vw to prevent overflow on small screens."

Smallest restoration

One style function in MobileNav.tsx. No API, token or default changes. From 377 px up, 85vw is at least 320 px, so the default drawer is unchanged there.

Siblings: #8042, #8046 and #8057 also add ci.yml steps, and #7358, #7356 and the close-path fix #8064 touch MobileNav.tsx; whichever lands second rebases.

Evidence

Before (main) and after, 320 × 568, drawer open:

320 px before
320 px after

iOS 26.2 simulator, real taps (402 px: the drawer keeps 320 px): a tap on the strip closes it:

tap on the strip closes the drawer

  • Reproduction before the change: on a 320 px phone the drawer is 320 px wide. The new Chromium contract fails against a main Storybook (expected 272, received 320).
  • Result after the change: a 272 px drawer and a 48 px strip; the strip is backdrop (elementFromPoint is the dialog), and a real tap on it closes the drawer.
  • Representative unchanged path: on a 402 px phone the drawer keeps its 320 px width and the 82 px strip.
  • Regression test or other mutation-sensitive proof: MobileNavWidth.a11y.chromium.spec.ts (real Chromium, touch), plus a jsdom test that the drawer's own class declares max-width: 85vw and takes its width from the prop.

Scope

  • 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 exec vitest run packages/core/src/MobileNav packages/core/src/AppShell: 136 passed.
  • pnpm -F @astryxdesign/core typecheck; eslint and prettier on touched files; pnpm check:repo (pre-commit).
  • pnpm exec playwright test packages/core/src/MobileNav/__tests__/MobileNavWidth.a11y.chromium.spec.ts --project chromium against a fresh Storybook build: 2 passed. Against main: the 320 px test fails and the 402 px test passes.
  • CI: a new "Run MobileNav width contract" step in the a11y contract job, after the Token remove target contract.

The width prop is documented as "capped at 85vw to prevent overflow on
small screens", but the drawer's width was min(100vw, width): on a 320 px
phone the default 320 px drawer covered the whole screen and left no
backdrop to tap. It is now min(width, 85vw), so a 48 px strip of the page
stays beside it, and a tap there closes it. Wider screens are unchanged.
@vercel

vercel Bot commented Oct 24, 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 Oct 24, 2026 4:15am UTC

Request Review

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 24, 2026
@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 24, 2026, 4:46 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

46 of 494 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 26 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No changes requested: setting the drawer to width: <width>px; max-width: 85vw brings MobileNav back to its documented 85vw cap, so on a 320 px phone the drawer is 272 px wide and a tap on the 48 px backdrop strip beside it closes it, while the default drawer is unchanged from 377 px up. The new jsdom test fails against the current behaviour and the Chromium width contract passes, so the restored cap stays guarded.

[Automated review]

@cixzhang
cixzhang merged commit d0c4bf2 into meta:main Oct 25, 2026
63 checks passed
@vjeux
vjeux deleted the uikit/c14-mobilenav-width branch October 25, 2026 02:57

This branch was successfully deployed

1 active deployment
Preview — 528a2cbd Deployed Oct 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants