Repository navigation
fix(MobileNav): leave pinch-zoom to the browser while open - #7193
Conversation
The open nav covers the viewport and declared touch-action: none, with pan-y on its content, so a pinch anywhere on screen did nothing. Declare pinch-zoom instead: pans are still kept from the page behind, and a pinch zooms the page.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
|
There was a problem hiding this comment.
Thanks for the focused fix — the runtime change itself checks out. I re-measured it in a real browser at a phone size: with the nav open, a pinch over the nav content zoomed the page to about 2.06x and a pinch over the backdrop strip beside the panel zoomed it to about 2.08x, where the same gestures stayed at 1.00x before the change, and the existing MobileNav suites still pass (62/62). No runtime change is requested.
One change requested on the new regression test: its backdrop case does not actually pinch the backdrop. On the measured story geometry the drawer occupies x 70-390 of the 390-wide viewport, and the case derives its pinch point from the Dashboard link box, landing at x = 386 — inside the panel, on the scrollable content. So the shipped guard never exercises the backdrop surface it names (the two declarations are coupled today through ancestor touch-action intersection, which is the only reason a root regression would still trip a case). Please derive that point from the drawer geometry instead — for example the midpoint of the strip the drawer does not cover, made side-aware — and assert the pinch starts outside the drawer, so the test guards the surface its name and the evidence table claim.
[Automated review]
…it is on The backdrop case derived its point from a nav item's box and landed inside the panel. Measure the panel itself, pinch in the strip beside it, and assert both fingers land on the backdrop.
There was a problem hiding this comment.
Approving. The backdrop case now pinches the backdrop, and the fix itself holds up in a real browser.
- Chrome 155 on a Linux rig, the committed spec run as-is against two Storybook builds from this head: with
MobileNav.tsxat its base version, 2 of 2 fail (visualViewport.scalestays 1 over the content and over the backdrop); at this head, 2 of 2 pass. - The backdrop finger positions are now derived from the panel's own box, pick the wider uncovered strip whichever side the panel sits on, and the spec asserts each finger is outside the panel and that
elementFromPointreturns the dialog before pinching — so the test guards the surface it names. - Since the earlier review: only the spec changed;
MobileNav.tsxis byte-identical to bcc006e. The MobileNav suites pass 62/62. Core patch Changeset present.
[Automated review]
## User impact Readers who zoom a phone page could not pinch-zoom when a finger landed on a reorder grip in Lab's `ListInput` or `TransferList`. The grips start every row, so a pinch over the list often lands on one. Now the pinch zooms the page and the order stays, whichever finger lands on the grip. A one-finger drag still reorders. ## Problem and solution fit - **Why does the pinch do nothing?** Both grips declare `touch-action: none` (shared `reorderStyles.ts`), which refuses pinch-zoom for touches that start there. - **Why does that harm the task?** Zoom is how a reader enlarges the form's text. - **Why does it matter?** Zoom is how many readers resize text on a phone (WCAG 2.2 SC 1.4.4, AA). ## Expected behavior and authority - `spec:AST-020` FR1 (current): WCAG 2.2 A and AA, so SC 1.4.4 Resize Text. - Precedent: #7192, #7193, #8042. ## Smallest restoration - `reorderStyles.ts`: the grip and its active state declare `touch-action: pinch-zoom` instead of `none`. The grip still refuses panning, so a one-finger drag moves its row from the first move, as today. When a pinch starts on a grip, the browser cancels the pointer, which ends the drag as a cancel (the order is kept). No new API, visual change or drag change; UIKit's hold-then-drag claim comes later, with the core List reorder. ## Evidence Chrome phone emulation with CDP two-finger touch, on both Lab stories, zoom after a 2.5× pinch: | Pinch | main | This change | | --- | --- | --- | | First finger on a grip | 1.00× | > 1.2×, order kept | | Second finger on a grip | 1.00× | > 1.2×, order kept | | One finger dragging a grip | reorders | reorders | iOS 26.2 simulator, Safari, scripted pinch to 2.5× with one finger on the first grip: | | main | This change | | --- | --- | --- | | Computed `touch-action` | `none` | `pinch-zoom` | | Zoom after the pinch, ListInput | 1.00× | 1.60×, order kept | | Zoom after the pinch, TransferList | 1.00× | 1.92×, order kept | | One-finger drag on the first grip | reorders | reorders |  - Reproduction before the change: `ReorderGripPinchZoom.a11y.chromium.spec.ts` fails 4 of 4 pinch cases against main's Storybook build. - Result after the change: 6 of 6 pass. - Representative unchanged path: the one-finger drag, on both builds, in Chrome and iOS Safari. - Regression test: the new spec. ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Testing - `pnpm exec playwright test packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts --project chromium` against main's Storybook build (4 failed, 2 passed) and this branch's build (6 passed). - iOS 26.2 simulator (iPhone 17 Pro), Safari, against both builds, as above. - CI runs the new spec in its own pr-a11y step in `ci.yml`; `pnpm exec vitest run .github/scripts/ci-test-routing.test.mjs .github/scripts/release-check-workflow.test.mjs`: 101 passed. - `pnpm -F @astryxdesign/core build:css && pnpm -F @astryxdesign/lab build:css`, then `pnpm exec vitest run --project node scripts/build-css.test.mjs`: 11 passed. - `pnpm -F @astryxdesign/lab typecheck`: the new spec typechecks (the one existing error is in `MobileTokenizer.test.tsx`, on main too). `pnpm check:repo` (pre-commit); ESLint and Prettier on the touched files. - No changeset: `@astryxdesign/lab` is private. Also in this change: a second pointer that lands during a pointer reorder (the second finger of a pinch) cancels the reorder in ListInput and TransferList, so a pinch whose first finger slid on a grip zooms and keeps the order.
## User impact People who zoom a phone page to read it could not pinch-zoom from a list of swipeable rows: a pinch that started on an `Item` or `ListItem` with `swipeActions` did nothing, and in iOS Safari a sideways pinch swiped the row open. Such rows usually fill the screen. Now that pinch zooms the page and the row stays put, whichever finger lands first. One-finger swipes and scrolling are unchanged. ## Problem and solution fit - **Why does the pinch do nothing?** The row's `touch-action: pan-y` refuses pinch-zoom, and the swipe tracked only its first finger: a sideways pinch crossed the axis lock, so the row claimed it and cancelled `touchmove`. - **Why does that harm the task?** The rows leave no other surface to pinch. - **Why does it matter?** Zoom is how many readers resize text on a phone (WCAG 2.2 SC 1.4.4, AA). ## Expected behavior and authority - `spec:AST-020` FR1 (current): WCAG 2.2 A and AA, so SC 1.4.4 Resize Text. - `spec:AST-057` (current) is silent on `touch-action` and second fingers. - As BottomSheet (#7192, #7198) and MobileNav (#7193). ## Smallest restoration - `Item.tsx`: the swipe root declares `pan-y pinch-zoom`. - `useSwipeAction.ts`: a second touch landing before the axis is decided, anywhere on the page (a document listener, only while that touch is undecided), hands the touch to the browser. A non-first pointer never starts a swipe. A swipe under way keeps its finger. No new API, no visual change. ## Evidence iOS 26.2 simulator, Safari, a pinch on the first row (to 2.5×): main stays at 1.00× and swipes the row open; this change zooms to 2.00×, the row still (`touch-action` `pan-y` → `pan-y pinch-zoom`).  Chrome (phone emulation, CDP touch), zoom after the pinch, main → this change: sideways on the row 1.00× → 2.06× (row dragged 60 → 0 px); vertical across two rows 1.00× → 3.97×; one finger below the list, either order, 1.00× → 5.00×. `pinch-zoom` alone still dragged the row 15 px. - Reproduction: `ItemSwipePinchZoom.a11y.chromium.spec.ts` fails 4 of 4 pinch cases on main; 4 of 5 new unit tests fail on main's code; all pass after. - Unchanged: the one-finger case, `ItemSwipeActions.a11y.chromium.spec.ts`, the swipe unit tests; in iOS Safari a one-finger swipe still rests open. - Regression tests: the spec and the unit tests (second finger on/off the row, non-first finger, owned swipe, listener lifetime). ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Testing - `pnpm exec vitest run packages/core/src/Item packages/core/src/List`: 159 passed. - `pnpm exec playwright test packages/core/src/Item/__tests__ --project=chromium` against main's Storybook build and this branch's build, as above. - iOS 26.2 simulator (iPhone 17 Pro), Safari, against both builds, as above. - CI runs the new spec in its own pr-a11y step in `ci.yml`; `pnpm exec vitest run .github/scripts/ci-test-routing.test.mjs .github/scripts/release-check-workflow.test.mjs`: 101 passed. - `pnpm -F @astryxdesign/core typecheck`, `pnpm check:changesets`, `pnpm check:sync`, `pnpm check:repo`; ESLint and Prettier on the touched files. ### Video per path Chromium, real touch (CDP), main left, this change right; dots are a page overlay drawn from the page's touch events: 
User impact
People who zoom a phone page to read it could not pinch-zoom at all while MobileNav was open. The open nav covers the whole viewport (panel plus backdrop), so a pinch anywhere on the screen did nothing until the nav was closed.
After this change, a pinch over the nav content or the backdrop zooms the page.
Problem and solution fit
<dialog>declaredtouch-action: noneand its content declaredpan-y. Neither allowspinch-zoom.nonewas there to keep pans (pull-to-refresh, background scroll) from reaching the page.pinch-zoomstill allows no panning, so that purpose is unchanged. It only stops refusing the pinch.Expected behavior and authority
spec:AST-020FR1 (current): WCAG 2.2 A and AA are the conformance baseline.component:MobileNavis a draft and says nothing about touch-action.Smallest restoration
Two declarations in
MobileNav.tsx:none→pinch-zoompan-y→pan-y pinch-zoomNo logic changes. MobileNav has no custom gesture handler that could claim a second finger.
Evidence
Real Chrome 155 (headless, phone emulation 390×844 @3×, CDP two-finger touch input),
core-mobilenav--default, nav open:MobileNavPinchZoom.a11y.chromium.spec.tsfails 2 of 2 against a main build (visualViewport.scalestays 1).pinch-zoomallows no pan.touch-action, so a unit test could not observe it.Same pinch on the open nav, before and after:
Scope
Testing
pnpm exec vitest run packages/core/src/MobileNav: 62 passed.MobileNavPinchZoom.a11y.chromium.spec.ts(Playwright, Chrome channel) against the main build and against this branch's build, as above. It runs in the release-check a11y contract with the other*.a11y.chromium.spec.tsfiles.