Skip to content

fix(BottomSheet): leave pinch-zoom to the browser - #7192

Merged
cixzhang merged 2 commits into
mainfrom
fix/bottomsheet-pinch-zoom
Oct 8, 2026
Merged

cixzhang merged 2 commits into
mainfrom
fix/bottomsheet-pinch-zoom

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

User impact

People who zoom a phone page to read it (low vision, small text) could not pinch-zoom while a BottomSheet was open if the pinch started on the sheet. Over the handle, the title, the content, or across them, the pinch did nothing, and the sheet usually fills most of the screen. Menus and pickers that present as sheets on phones had the same problem.

After this change, a pinch on the sheet zooms the page and the sheet stays at its detent. One-finger drag on the handle and one-finger scrolling in the content work as before.

Problem and solution fit

  • Why does the pinch do nothing? The sheet declared touch-action: none on the panel and handle and pan-y on the content. Neither allows pinch-zoom, so Chromium and Safari don't start a zoom for a gesture that begins there.
  • Why does that harm the task? The sheet is modal and tall, so a reader who needs to zoom has almost nowhere else to pinch.
  • Why does it matter? Zoom is how many readers resize text on a phone (WCAG 2.2 SC 1.4.4 Resize Text, AA).

Changing the CSS alone fixes the zoom, but in real Chromium a pinch that starts at the top of the content still dragged the sheet down about 196px while the page zoomed. That happens because the second finger's touchstart replaced the armed pull-down. So the fix also makes a second finger end any sheet drag in flight or armed.

Expected behavior and authority

  • spec:AST-020 FR1 (current): WCAG 2.2 A and AA are the conformance baseline.
  • WCAG 2.2 SC 1.4.4 Resize Text (AA).
  • component:BottomSheet is a draft and says nothing about touch-action or pinch, so this doesn't change any recorded contract.

Smallest restoration

  • BottomSheetPanel.tsx: handle none → pinch-zoom, content pan-y → pan-y pinch-zoom.
  • useSheetGestures.ts: the sliding surface and handle guards none → pinch-zoom. A non-primary pointer on the handle, or a second touch on the content, cancels the drag and returns the sheet to its detent. Nothing else changes.
  • Out of scope: DropdownMenu, ContextMenu, and Selector also declare touch-action: none on lists whose rows fit. A current module contract requires that value, so it needs its own decision.

Evidence

Real Chrome 155 (headless, phone emulation 390×844 @3×, CDP two-finger touch input), on the core-bottomsheet--text-only story:

Gesture on the open sheet Before (main) After
Pinch across handle and content page zoom 1.00× zoom > 1.2×, sheet moved < 2px
Pinch at the top of the content, vertical spread 1.00× zoom > 1.2×, sheet moved < 2px (CSS-only arm: zoomed and dragged the sheet ~196px)
Pinch in the content, sideways 1.00× 4.15×
One-finger drag on the handle sheet follows (+120px) sheet follows (+120px)
One-finger swipe in the content scrolls ~330px, no zoom scrolls ~330px, no zoom
  • Reproduction before the change: BottomSheetPinchZoom.a11y.chromium.spec.ts against a main build fails 3 of 4 tests (the three pinches, visualViewport.scale stays 1). The one-finger test passes.
  • Result after the change: the same spec against this branch's build passes 4 of 4.
  • Representative unchanged path: one-finger handle drag and content scroll (spec test 4, both builds).
  • Regression tests: 4 new useSheetGestures unit tests (touch-action values, second pointer on the handle, second finger before and during a content pull). All 4 fail on main and pass here.

Same pinch in the content, before and after:

Before: the page stays at 1.00x after a pinch on the sheet. After: the page zooms to 5.00x.

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/BottomSheet: 249 passed.
  • BottomSheetPinchZoom.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.ts files.

@vercel

vercel Bot commented Oct 8, 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 8, 2026 10:00pm UTC

Request Review

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

astracat-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Oct 8, 2026, 10:31 PM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 8, 2026
A pinch that started on an open sheet did nothing: the sheet declared
touch-action: none on the panel and handle and pan-y on the content, and
a second finger could still promote or continue a sheet drag. Declare
pinch-zoom alongside the one-finger gestures, and end any drag in flight
or armed when a second finger lands, so the page zooms and the sheet
stays at its detent.
@github-actions

github-actions Bot commented Oct 8, 2026 •

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

24 of 442 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 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
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,229
Chat With Attachments probe dark 11,065
TableRowExpansion Detail Panel neutral dark 5,129
TableRowExpansion Detail Panel neutral light 4,050
SideNav Resizable in AppShell probe dark 3,208
SideNav Resizable in AppShell probe light 3,208
TableGroupedRows Default neutral light 2,133
TableGroupedRows Default neutral dark 2,116
Markdown Default probe dark 897
Markdown Default probe light 897

and 4 more.


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

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

Summary

Thanks — this restores pinch-zoom on an open BottomSheet for the placements covered here. I reproduced the behavior in Chromium on the text-only story: before this change the same pinch leaves the page at 1x; after it, a pinch across the handle and body zooms with no sheet travel, the top-of-body pinch zooms cleanly, and all 249 BottomSheet unit tests pass.

One uncovered finger order still drags the sheet

A pinch across both surfaces depends on which finger lands first:

  • Handle finger first, body finger second (the order tested here): page zooms, sheet travels 0px.
  • Body finger first, handle finger second: page zooms, but the sheet is dragged about 163px during the pinch before returning to its detent.

The likely cause is that the body's touch arming isn't cleared when the second finger lands on the handle: the handle's non-primary pointer handler cancels a drag in flight, but the armed body touch can still promote into a sheet drag as the fingers spread.

Could you extend the second-finger hand-off so it also disarms the armed body gesture (or stop promoting a drag while two touches are down), and add the reversed order to the unit tests and the Chromium spec expecting < 2px travel? That looks like the only change needed — the scope boundary around menus/selectors and the rest of the approach look right.

[Automated review]

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

Approving. A pinch on an open sheet now zooms the page and the sheet holds its detent; one-finger gestures are unchanged. Reproduced both sides.

  • Chrome 155 on a Linux rig, BottomSheetPinchZoom.a11y.chromium.spec.ts run as committed against two Storybook builds from this head: with BottomSheetPanel.tsx and useSheetGestures.ts at their base versions, 3 of 4 fail (visualViewport.scale stays 1 for all three pinches) and the one-finger test passes; at this head 4 of 4 pass, including the vertical spread at the top of the content that the second-finger cancel exists for.
  • Red arm: with the two base product files restored, the four new useSheetGestures tests fail (touch-action values, second pointer on the handle, second finger before and during a content pull); at this head the file passes 66/66, so the nested-scroller pull-down handoff is intact, and the BottomSheet directory passes 249/249.
  • The spec's glob is already in playwright.config.ts, so it rides the a11y contract. Core patch Changeset present; no API or visual change.

[Automated review]

@cixzhang
cixzhang merged commit 1eb16a0 into main Oct 8, 2026
48 checks passed
@cixzhang
cixzhang deleted the fix/bottomsheet-pinch-zoom branch October 8, 2026 23:13
cixzhang pushed a commit that referenced this pull request Oct 24, 2026
## 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 |

![After the pinch: on main both pages stay at 1x; with this change ListInput zooms to 1.6x and TransferList to 1.92x.](https://raw.githubusercontent.com/vjeux/astryx/c5fcb583ab5d941e5ce0f3cca61a10ae910ce486/lab-reorder-grips/pinch-zoom/ios-grip-pinch-before-after.png)

- 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.
cixzhang pushed a commit that referenced this pull request Oct 24, 2026
## 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`).

![Main above: the row swipes open, no zoom. This change below: the page zooms, the row stays.](https://raw.githubusercontent.com/vjeux/astryx/d7aebf31d4333487b8300412e20670f7b7310c2b/item-swipe-pinch-zoom/ios-pinch.gif)

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:

![Sideways pinch on a row, vertical pinch across two rows, one finger on the row and one below the list in either order: main swipes the row, this change zooms the page. A second finger while a swipe is under way: the swipe keeps its finger.](https://raw.githubusercontent.com/vjeux/astryx/d7aebf31d4333487b8300412e20670f7b7310c2b/item-swipe-pinch-zoom/chromium-pinch-paths.gif)

This branch was successfully deployed

1 active deployment
Preview — 8349dd6b Deployed Oct 8, 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.

1 participant