Repository navigation
feat(mobile): drag sheets to close with position-only motion - #425
Merged
Merged
Conversation
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
Dragging from a sheet's grabber or noninteractive header did nothing after #425, while dragging Updates' refresh button could close it. Shared chrome only requested the responder on movement; it never explicitly claimed the initial touch. The handle was also only 28 dp tall. This change requests touch start in the **bubbling** phase on the shared native drag-area View. A descendant Pressable gets first refusal, so header buttons retain normal taps. Move capture takes over only for one finger moving more than 6 dp vertically, with vertical travel greater than horizontal travel. The grabber now occupies a full-width, 44 dp zone with the visible pill centered and excluded from hit testing. Acquiring the responder alone does not start a drag. Position work and keyboard dismissal wait for deliberate vertical movement; a tap or horizontal movement on plain chrome leaves both alone. The responder factory remembers whether acquisition happened through move capture because RN resets `dy` on grant. Existing gesture math, springs, exit lifecycle, backdrop tracking, keyboard-first dismissal and accessibility actions are preserved. Fixes: #425 ### Scope and responder review - Shared `SheetDragArea` forwards handlers directly to a native View. `SheetSurface`, `PickerSheet`, Updates and every other marked header inherit the fix without per-screen handlers. The grabber uses the same path. No gesture handlers were added to scrollable content. - Inspected the shared surfaces, all grabber/header wiring and #425's description/diff. The viewport's `pointerEvents="box-none"` leaves children interactive; the sheet extension is below the surface and has `pointerEvents="none"`. The existing translucent Android Modal and safe-area layout remain unchanged. - Reviewed [RN responder bubbling/capture](https://reactnative.dev/docs/gesture-responder-system), [PanResponder lifecycle](https://reactnative.dev/docs/panresponder), and installed RN 0.88.1's `PanResponder.js` and Fabric responder implementation. RN supports move negotiation without an existing responder, so the refresh-button symptom is consistent with missing initial acquisition on native chrome, rather than proof that move negotiation always requires a child responder. Physical-device reproduction was unavailable. - JS/TS implementation only; no dependencies, native modules, assets, app config or runtime policy changed. Updated the existing Polish mobile documentation. No UI copy changed; copy audit is not applicable. ### Validation - `bun install --frozen-lockfile` and `bun run gen:check` passed. - `bun test tests/integration/mobile-sheet-gesture.test.ts`: **5 passed, 0 failed, 51 assertions**. Pure decision coverage includes initial chrome acquisition, control/content exclusion, taps/jitter, vertical direction and dominance, configurable threshold and multiple fingers; existing distance/fling/rubber-band/re-grab coverage also passes. - `bun run typecheck`, `bun run lint` and `bun run format:check` passed. Expo ESLint passed for all three changed mobile source files. - `bun run --filter @canopy/web build` passed. - No full local `check:tmp`, UI tests, device/simulator runs, native builds or OTA publication. CI is the full-suite gate; the device checks below remain **unperformed**. ### OTA fingerprint comparison Generated on clean current `dev` (`04a871be3b18c4abf15910ec31d0071e69795d73`) before editing and on the final implementation, from `apps/mobile`, for **both** platforms: ```sh bunx [email protected] fingerprint:generate --platform ios --build-profile production --json --non-interactive bunx [email protected] fingerprint:generate --platform android --build-profile production --json --non-interactive ``` | Platform | Current dev | This change | | --- | --- | --- | | iOS | `bf3156a1bd878e10c0b0be25d4c194a837fb1b7e` | `bf3156a1bd878e10c0b0be25d4c194a837fb1b7e` | | Android | `d638e5f7b7fa87f54ccc0715c5fe150b8c0ad3ae` | `d638e5f7b7fa87f54ccc0715c5fe150b8c0ad3ae` | Both runtime fingerprints are unchanged from current dev, including #424's baseline changes. This supports OTA compatibility with that runtime. ### Manual checks required on iOS and Android Run the interaction checks for each applicable sheet in this matrix, separately on iOS and Android. Include light/dark, a phone and a wide window, and short/typical/long titles. These are instructions, not claimed results. | Sheet family | Coverage | | --- | --- | | Choice pickers | Model, effort, project, worker, provider/profile and permission choices | | Action menus | Thread actions, queued-message actions, attachment menu and text actions | | System sheets | Updates, connection details and gateway-update details | | Forms | Goal, side thread, queued-message editor, thread secrets, search, quote editor and settings inputs | | Full details | Thread, bot and other details/settings presented through `SheetSurface`/`Sheet` | | Interaction | Steps and expected result | | --- | --- | | Grabber | Start on the pill, then in the blank area near either side of its full-width 44 dp zone. Drag slowly down. Each start must move the sheet; a stationary tap must not start a drag. | | Header empty area | Start on title text and on blank space in the header row, away from controls. Move vertically beyond 6 dp. The sheet must follow; horizontal movement and movement of 6 dp or less must not begin a drag. | | Header button drag | In Updates, start on Check now, then drag down beyond 6 dp with vertical dominance. Repeat on a header close/action button in a full sheet. The sheet must take over and the button action must not fire on release. Disabled header controls must not create dead drag zones. | | Header button tap | Tap Check now or another enabled header action without dragging. Its action must run once, with no sheet movement. Repeat with small finger jitter. Tapping Close must use the normal exit exactly once. | | Keyboard open | In a searchable model picker and an editable form, focus the input and type. A tap on plain chrome must leave the keyboard alone. The first vertical drag must dismiss only the keyboard and keep the sheet still for the rest of that touch; release, then drag again to move/dismiss the sheet. Verify the draft remains intact. | | Motion/lifecycle | Steps and expected result | | --- | --- | | Distance and fling | Without the keyboard, release a slow drag below 28% of sheet height: spring back. Release beyond 28%: dismiss. Fling down after at least 8 dp at roughly 900 dp/s or faster: dismiss even below 28%. Once active, slow downward travel must follow 1:1 and the backdrop must track position. | | Reversal and interruption | Drag up: bounded rubber-band resistance. Reverse sharply upward before release: cancel dismissal. Re-grab during spring-back: no position jump. Interrupt a gesture with OS controls or Android back: no stuck sheet or stale gesture overwriting an exit. | | Reduced motion and accessibility | Enable reduced motion: automatic slides/springs become instant while dragging still works. With VoiceOver/TalkBack, invoke the grabber's Close action and verify dismissal; check accessibility escape where available. | | Scroll and native Modal | Scroll content at the top and midway: native scrolling must remain independent. Open/close repeatedly and rotate/fold: no blocked hit areas, safe-area offsets or transparent seams. On Android verify backdrop tap and back dismissal. |
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Android thread cards can lose their Run choice when virtualized, discard loaded thumbnail URIs when leaving the viewport, and move the feed as the composer folds. Thread details also share entrance progress with drag position and have no intermediate resting position. This change keeps HTML consent and measured heights per visual/version for the pairing session, uses a compact 112 dp gate, preserves thumbnail Image instances and synchronously restores cached file URIs on remount, retains the composer scroll reserve, and separates sheet entrance from drag offset. Thread details snap fully open or 40% down; dragging beyond 65% closes them. The scroll viewport remains usable at both positions. Visual resize updates use the existing feed anchor, and Android clipping no longer detaches native WebViews inside retained inverted cells. Distant turns remain virtualized. Web behavior is unchanged. Fixes: #719 The linked regression is specifically the per-mount HTML Run state introduced in #719; the other behavior is pre-existing. Related: #758, #419, #425. Rebased onto #758 and retained its notice removal and `Custom HTML from the agent.` gate label. ### Original recording Reviewed at 12 fps; timestamps are seconds from the start, with approximately 0.08 s precision. | Problem | Evidence | Change | | --- | --- | --- | | Tall blank HTML card; Run does not reveal content | 00.00–12.50 and 21.00–24.67; taps around 09.50/10.17 | Compact gate; session consent across row/slot/fullscreen remounts; explicit non-flex WebView sizing; token-validated height updates and anchored resize. Failure/watchdog revokes consent, so failed code does not automatically run again. | | Composer flips between compact/full | 01.00–01.50, 06.17–06.50, 10.75–11.17, 22.75–23.17 | Folding no longer releases the native list reserve; only active finger travel can change fold state, and expansion requires deliberate travel toward the end. Momentum interrupted by a tap cannot inherit drag intent. | | Details sheet jumps/rebounds; content also shifts | Opening 12.83–13.33; dragging 13.75–20.75; inner content 18.25–18.83 | Explicit surface height and seeded modal safe areas; separate entrance/drag values; two resting positions; bottom-only scroll viewport resize and no native scroll bounce. Re-grabbing an opening/settling sheet retains its position. | | Thumbnail disappears and reloads | 22.00–24.17 | Visibility cancels unfinished work without clearing a loaded URI. Cache peek restores the same immutable local URI before the first remount frame, allowing native decoded bitmap reuse. Existing memory/disk LRU budgets and pairing cleanup remain in force. | | Feed displacement during interactions/card changes | 06.17–06.50, 10.75–11.17 | Stable composer reserve; no Android autoscroll-to-zero threshold; existing disclosure anchor also wraps Run and visible WebView height changes. The recording alone cannot separate every gesture movement from layout correction. | ### Validation - Passed with `nice`: `bun install`, `bun run gen:check`, workspace `bun run typecheck`, mobile typecheck, repository `bun run lint`, `bun run format`, `bun run format:check`, and integration-test workspace typecheck. - Passed 10 unit tests: existing private image cache and pure sheet gesture tests, plus session consent isolation/revocation coverage. These are local unit tests under the existing tests directory; no UI suite or E2E tests were added or run. - Additional Expo lint remains failing on existing repository findings: clean dev has **116 errors / 25 warnings**, this change has **112 errors / 25 warnings**. Changed image/watchdog code removes some existing findings; the remaining Expo failures are not claimed as passed. - Native fingerprints match clean dev before/after, including explicit `CANOPY_CHANNEL=nightly`, using `bunx expo-updates fingerprint:generate --platform ...`. Nightly Android: `141ef4e8c825ee4fc5d22c499402b284741b0970`; Nightly iOS: `83794f069934a7374461427d89b8d008cec19d97`. Default-channel Android: `906dc944f94eb8333fa384ed9f198834fdd30d13`; iOS: `138e0c6b171c82b4933e86808cdfef56da73b8c6`. No dependencies, native modules, plugins, or native config changed. - **Device acceptance is unverified.** T3 device discovery found no local Android SDK. MacStudio device hub timed out twice (no device returned). EAS `device_open` failed: “frameAncestors and corsOrigins are supported on Production and Enterprise plans,” while this account has Starter. No emulator or physical device could be opened, so first-tap rendering, Android WebView height/gesture handling, decoded bitmap retention, snap motion, keyboard transitions, light/dark, and TalkBack still need device review. No after-shots are claimed. Draft PR preserves this outstanding gate. No web files changed; web build was not run. Full `check:tmp`/integration runs, native prebuilds/exports, EAS builds/updates, tags, and releases were not run. Original frame strips are retained outside the repository; raw extracted frames were removed. No servers, device processes, or reserved ports were used. ### Copy audit (§8) No new UI wording. `Run`, `Retry`, and `Custom HTML from the agent.` remain unchanged from #758; no secrets notice was reintroduced. Changes are session behavior, geometry, cache lifetime, and motion. Device layout/accessibility checks remain unverified.
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.
Updates and every mobile sheet can now be dragged down from their grabber or header. The shared surface enters, settles and exits by position only; only the backdrop fades. Compact pickers, confirmations and full-height forms share the same spring and dismissal lifecycle on iOS and Android, including wide-window cards.
The gesture follows downward travel 1:1, adds diminishing upward resistance, and dismisses after 28% of the measured height or a downward fling of at least 900 dp/s after 8 dp. It preserves release velocity, returns interrupted/short drags, and prevents a late touch event from overwriting an exit. Shared close buttons, backdrop taps, accessibility actions and Android back finish the exit before notifying a parent that may unmount the sheet. The first drag with an open keyboard dismisses the keyboard; another drag moves the sheet. Reduced motion makes automatic positioning instant.
Coverage:
Overlay,PickerSheet(models, effort, permissions, projects, workers, thread actions and attachment menus), confirmations, Updates, connection/update details, goal/side-thread/queued-message forms, and allSheetSurfaceforms/details. Full-screen image/text/file viewers retain their own viewer behavior.Scope and limitations
Validation
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check, andbun run --filter @canopy/web build.bun test tests/integration/mobile-sheet-gesture.test.ts— 3 focused math tests, 27 assertions, covering dismissal distance/velocity, the rubber-band curve and re-grabbing without a position jump.Unstable baseline tests on the shared host
This machine is shared by several agents. Timing-sensitive integration tests failed under concurrent load (host load exceeded 60). The files below are unchanged by this feature, and every affected file passed a targeted rerun. These reruns support the load-related explanation but do not establish a clean full-suite result. Per maintainer authorization, CI on isolated runners is the full-suite gate for this PR.
bun run check:tmpbun run check:tmp --timeout 30000--timeout 30000All three attempts reported
check:tmp: nothing left in the temp dir. No further full runs were started.Affected files are under
tests/integration/:agent-plugins.test.tsagent-skill-sources.test.tsFixture git failed: pushand asynchronous errors.agent-skills-files.test.tsbots-harness-regressions.test.tsbots-harness.test.tsconfig-sync-projects.test.tslinked-timeouts.test.tsundefined); stale-read recovery failed a 20 s eventual assertion; BFF request-slot scenario did not observe the expected peer request.thread-mirror-deltas.test.tscomposer-shell.test.tsConnectError [canceled] The operation was aborted.around the 10.1 s RPC deadline in attempts two and three. It passed in attempt one.Clean targeted reruns (all using
bun run check:tmp --timeout 30000):agent-plugins.test.tsthroughlinked-timeouts.test.tslisted above: 80 passed, 0 failed, 6591 assertions, 221.49 s.tests/integration/composer-shell.test.ts: 17 passed, 0 failed, 72 assertions, 14.94 s.tests/integration/thread-mirror-deltas.test.ts: 12 passed, 0 failed, 88 assertions, 22.71 s.Every targeted rerun also confirmed the temporary directory was clean. The current isolated rerun has finished; no test run remains active.
Fingerprint command, run before and after for both platforms from
apps/mobile:bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive2a0ef03a2a0fda8e7fad2e3df8609803d2edbda32a0ef03a2a0fda8e7fad2e3df8609803d2edbda3c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07dc5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07dManual checks required on iOS and Android
These are not performed: the installed clients cannot run this checkout. Check both light/dark themes, phone width and a wide/foldable window.
Copy audit (
docs/copy.md§8)Before: a decorative, unlabeled grabber. After: button label/action
Close, with hintDrag down to close.The action starts with a verb; the hint has four words, sentence case and a period. The control has a spoken action and does not rely on its shape or position. Existing contextual close labels remain unchanged. No new errors, statuses, glossary terms or decorative text. The new fixed strings cannot truncate; surrounding short/long titles retain existing wrapping rules. Device checks of VoiceOver/TalkBack and visual layout are pending as described above.Related: #371