Skip to content

improve(ui): mobile sheets move with iOS-style springs, flicks and swipe-to-dismiss - #188162

Merged
roboclaw-bot merged 3 commits into
mainfrom
openclaw/improve-mobile-sheet-animations-and-testing
Oct 30, 2026
Merged

roboclaw-bot merged 3 commits into
mainfrom
openclaw/improve-mobile-sheet-animations-and-testing

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by @vyctorbrzezowski.

Work sessions

What Problem This Solves

Mobile sheets in the Control UI do not move like the iOS sheets people expect: the Panels sheet fades in place, disappears instantly on close, ignores flicks, snaps between heights without easing, and cannot be swiped away. The Inbox and Filter & sort sheets cannot be swiped down at all.

User Impact

On phones, the Panels sheet, the Inbox and Filter & sort sheets, the navigation drawer, in-sheet pages and the Details/Panels switch now share one iOS-style spring. Sheets slide up and back down, follow the finger, carry a flick's momentum into the next height, and close with a downward flick, a pull past half their minimum height, or a tap outside. Slow drags still leave the Panels sheet at exactly the height you chose. Reduced-motion users keep instant changes.

Why This Change Was Made

Motion now has one owner in ui/src/lib/motion/:

  • spring.ts solves Apple's duration/bounce spring in closed form and reduces it to a compact CSS linear() easing (13 stops, within 0.3% of the solver). base.css exposes it as one --motion-sheet token (441ms linear(…)) that every sheet, drawer, picker page and segmented-control transition reuses; a unit test keeps it generated from the solver.
  • gesture.ts holds the WWDC18 fluid-interface physics: release velocity over the last 100 ms, momentum projection with the scroll-view deceleration rate, and rubber-banding.
  • chat-mobile-host-release.ts decides where a released Panels sheet rests; the runtime then swaps in a one-off spring curve that starts at the finger's speed.
  • sheet-dismiss.ts gives the sidebar bottom sheets swipe-to-dismiss and an animated tap-outside dismissal.

Closing keeps hidden and inert as the immediate source of truth for focus and accessibility. transition-behavior: allow-discrete lets the hidden sheet finish sliding out, with the Panels launcher still visible. A sheet settling into the dock stays above the conversation until it arrives, so collapsing no longer drops it behind the chat. Live drag geometry is written to the sheet itself instead of the whole region, following the Vaul note that inherited custom properties restyle every descendant per frame.

CSS budget. The total Control UI CSS gzip budget was already exceeded on main (308,922 B against a 308,526 B cap), so any growth fails control-ui-performance. After consolidating to one motion token, reusing the existing page-reveal rule for push motion, logical inset-inline-start for the segmented thumb (no RTL rules) and native visibility interpolation for the drawer backdrop, the change adds 279 B gzip / 1,344 B raw (down from about 530 B gzip). Raw stays under its cap. @vyctorbrzezowski approved exceeding the gzip budget, so totalCssGzipBytes moves to 309,265 B (measured 309,201 B plus the 64 B build variance) with an approval note.

Accepted limits: engines without allow-discrete exit transitions (before Safari 18 / Chrome 117) still hide the sheet instantly, as they do today. An open panel tool or Details page stops presenting the moment the sheet closes, so it slides out with an empty body; keeping that content presented through the exit needs a closing state in the pane owner and is left as a follow-up. Escape and programmatic closes of the sidebar sheets stay instant.

Research: sources and what each one decided
Source What it established Used for
Apple: SwiftUI Spring Duration/bounce ↔ mass/stiffness/damping; Spring(duration: 0.5, bounce: 0.3) → stiffness 157.9, damping 17.6 Solver parameterization; unit test reproduces Apple's numbers
Apple: spring(duration:bounce:) Perceptual duration; bounce 0 is critically damped; springs preserve velocity when retargeted Bounce 0 for sheets; velocity hand-off on release
WWDC23 “Animate with springs” Springs are the only curve that stays continuous with an initial velocity; use perceptual duration, not settle time, for UI timing Gesture releases start at the finger's velocity
WWDC18 “Designing Fluid Interfaces” (implementation notes) Project momentum with UIScrollView.DecelerationRate.normal; relative velocity; rubber-band at boundaries projectDistance, close decision below the minimum, overscroll resistance
Apple HIG: Sheets Resizable sheets rest at detents (medium ≈ half, large), resize by grabber or content Dock/expanded detents; flicks step one detent
Ionic iOS modal animation iOS sheet presentation reproduced as cubic-bezier(0.32, 0.72, 0, 1) over 500 ms Fitting target for the spring's pace
Emil Kowalski: Building a drawer component (Vaul), Vaul constants Velocity flick (0.4 px/ms), 25% close threshold, damped overdrag, avoid per-frame inherited custom properties Flick and dismiss thresholds; drag geometry on the sheet element
Chrome: CSS linear() easing linear() approximates springs with enough stops One stop per frame from the closed-form solution

Fit study. A grid search over Apple's spring space against the Ionic/Vaul iOS curve found the best match at bounce 0 and a 0.29–0.30 s perceptual duration (≈1.5% RMS of the travel distance over 600 ms). SwiftUI's default 0.5 s .smooth spring measured noticeably slower than iOS sheets, so the PR uses 0.3 s with no bounce. Critically damped springs never overshoot from rest and only overshoot when a release is faster than the spring's natural frequency, which is how momentum earns a little settle without any bounce at rest.

How it moves

Spring versus previous curve and the iOS curve; spring launched at release velocities

How a released sheet decides where to rest

Evidence

Panels sheet, before (left) and after (right). Same script, same touch input via Chrome DevTools Protocol, 390×844 mobile emulation. Steps include flicks, a slow drag past the top, close, and slow-motion replays with page animations at 20% speed.

panels-sheet-before-after.mp4

Navigation drawer and Filter & sort sheet, before and after, including swipe-down dismissal, a choice page, and tap-outside.

drawer-and-filter-sheet-before-after.mp4

Before: flicking the grabber up stops where the finger lifts.

Before: flick up leaves the sheet where the finger lifted

After: the flick carries the sheet to the expanded detent.

After: flick up settles on the expanded detent

Before: 120 ms after tapping ✕, the sheet is already gone.

Before: sheet vanishes immediately on close

After: 120 ms after tapping ✕, the sheet is sliding away.

After: sheet slides down on close

Measured motion. Visible sheet height sampled every animation frame, before versus after:

Measured visible height per frame for seven scenarios

Tests

  • New ui/src/e2e/mobile-sheet-motion.e2e.test.ts (8 cases): spring entrance and slide-out exit with the launcher still visible; flicks through dock → expanded → dock → dismiss; slow releases keep their height and only close past half the minimum; header-space drag with tappable controls and the sliding segment thumb; push/pop direction for Details pages; Filter & sort swipe-down, spring-back and tap-outside; reduced motion stays instant. Five of these cases fail on main (no spring, no flick detents, no exit, no swipe).
  • Unit: spring.test.ts (Apple's documented coefficients, monotonic critically damped curve, velocity hand-off, iOS-curve fit, CSS token sync), gesture.test.ts, chat-mobile-host-release.test.ts.
  • Regression: 18 existing mobile and panel E2E suites (Inbox sheet, shell geometry, session menus, panel layout, side-panel clearance, pull requests, details, outbox, owner filter, and more), sidebar/details browser suites, and related unit suites pass. mobile-inbox-sheet now asserts the shared spring's duration (< 500 ms) instead of the old 240 ms curve, and the layout test helper treats a sheet that is sliding out as already closed.
  • WebKit (Playwright 2370): open, expand, restore, flick up/down, flick-dismiss and close all animate (9–18 intermediate frames each) and reach the expected end states, confirming the allow-discrete exit in Safari's engine.
  • pnpm tsgo:ui, oxlint, stylelint, oxfmt --check, check:control-ui-controllers, git diff --check, test/scripts/control-ui-performance.test.ts, and a local pnpm ui:check-performance:base against the merge base (passes with the new cap: total CSS gzip 308,833 → 309,112 B).
  • After the CSS consolidation, 12 mobile/panel E2E suites (59 tests, including all 8 new motion tests) pass again.
  • Gesture tests are timing-independent: flicks dispatch input with explicit timestamps and slow placements pause before lifting, so CI load cannot turn a flick into a slow release. The shared Details test helper now ignores a sheet that is already hidden while it slides out (this fixed session-progress-live-placement on the first CI run). Both suites pass repeatedly locally.
  • chat-stream-runtime-budgets › “commits a streamed delta burst…” failed once in CI; it also fails 2 of 3 local runs on the unchanged merge base (92f70af), so it is a pre-existing flake unrelated to this change.
  • Local autoreview (shared helper, Codex engine, P0–P2, merge-base with origin/main → 8236d31, before the CSS consolidation): no actionable findings. The reviewer saw the diff without the surrounding pane-owner and popover lifecycle code and did not execute tests.

Not verified: a physical iPhone in Safari or the native iOS app; captures use Chromium mobile emulation and Playwright WebKit. Drag cost on low-end phones was not profiled.

Mobile Panels, Inbox and Filter & sort sheets now present, resize and
dismiss on one critically damped spring fitted to the iOS sheet curve.
Gesture releases carry their velocity into that spring, flicks step
between detents, a sheet pulled down or flicked down closes, and
closing sheets slide out instead of disappearing.

Co-authored-by: vyctorbrzezowski <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XL labels Oct 30, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 30, 2026
Collapse the sheet spring into --motion-sheet (duration plus a simplified
linear() curve within 0.3% of the solver), reuse it in every sheet,
drawer and picker transition, reuse the existing page reveal for in-sheet
push motion, and record the approved total CSS budget increase.

Co-authored-by: vyctorbrzezowski <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 30, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 30, 2026
Flicks dispatch input with explicit timestamps so release velocity does
not depend on runner load, slow placements pause before lifting, and the
Details helper ignores a sheet that is already hidden while it slides out.

Co-authored-by: vyctorbrzezowski <[email protected]>
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 30, 2026 08:13
@roboclaw-bot
roboclaw-bot merged commit 6052fff into main Oct 30, 2026
110 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/improve-mobile-sheet-animations-and-testing branch October 30, 2026 08:19
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…ipe-to-dismiss (openclaw#188162)

* improve(ui): give mobile sheets iOS-style spring motion

Mobile Panels, Inbox and Filter & sort sheets now present, resize and
dismiss on one critically damped spring fitted to the iOS sheet curve.
Gesture releases carry their velocity into that spring, flicks step
between detents, a sheet pulled down or flicked down closes, and
closing sheets slide out instead of disappearing.

Co-authored-by: vyctorbrzezowski <[email protected]>

* improve(ui): share one compact sheet motion token

Collapse the sheet spring into --motion-sheet (duration plus a simplified
linear() curve within 0.3% of the solver), reuse it in every sheet,
drawer and picker transition, reuse the existing page reveal for in-sheet
push motion, and record the approved total CSS budget increase.

Co-authored-by: vyctorbrzezowski <[email protected]>

* test(ui): make mobile sheet gesture tests timing-independent

Flicks dispatch input with explicit timestamps so release velocity does
not depend on runner load, slow placements pause before lifting, and the
Details helper ignores a sheet that is already hidden while it slides out.

Co-authored-by: vyctorbrzezowski <[email protected]>

---------

Co-authored-by: vyctorbrzezowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant