Repository navigation
feat(dashboard): add the fold-detection primitives from the foldable layout RFC - #33546
jeeshofone wants to merge 1 commit into
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: every new rule sits behind Notes
[DESIGN-REVIEWED] 41ee2fd Description read[DESCRIPTION-READ] 681d56fd48e51c00423f8a12a640cd62d3de45cfe27d9021463439d0f4b26d1a That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing a recording of folding and unfolding. That moment turns the phone layout into the two-pane layout and back, and no still image can show whether the user sees one layout become the other. Evidence gaps
Notes
[UX-REVIEWED] 41ee2fd Description read[DESCRIPTION-READ] dbd8b9e60af224529b87f88e84e52e8db23a2d0619cbbca3b42d39b6edc9beb7 That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK On a touch-first phone at 640px or wider, a reported fold now replaces the phone layout with the two-pane one, overriding the #30619 rule. That changes a default, and its only RFC is Notes
What this change shipsInventory (9 items) — 5 justifiedIntent: on a book-style foldable reporting a fold, show the sessions list beside the chat, ending at the fold. ADDITION.
Blockersproduct-shape change without accepted RFC — unjustified [FIRST-PRINCIPLES-REVIEWED] 41ee2fd Description read[DESCRIPTION-READ] 3ca2474bb94c89916e37ca57c95412df0bebbfb95af81a8001602cf424bf8691 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
181fecc to
0918b69
Compare
|
Re the First Principles BLOCK on Removed: Kept: |
0918b69 to
ed6c843
Compare
|
Re the First Principles BLOCK on What now reads the fold signal:
Two pieces from the original inventory still have no reader in this diff: the On the RFC being |
|
Re the GPT 6.1 BLOCK on |
ed6c843 to
04ce98f
Compare
|
Re the GPT 6.1 BLOCK on
|
|
Re the First Principles review of
|
|
Update for First Principles: with its next push, the fold-detection commit also keeps the side panel, and any app frame in it, mounted across a fold. Why it belongs in this commit: the fold rule here flips New tests: |
6e28bad to
712bebb
Compare
712bebb to
de496ce
Compare
|
Rebased onto current main with no content change (range-diff |
de496ce to
0abdc53
Compare
|
Fixed in
Pinned by two tests, each red with the old line restored:
|
…sion list ending at the fold
0abdc53 to
41ee2fd
Compare
|
Rebased onto current main after a conflict in |
Problem / Motivation
Goal: On a book-style foldable that reports its fold, the dashboard shows the sessions list beside the chat and ends the list at the fold, from 640px wide.
The fold-aware layout RFC (
docs/request-for-change/rfc-foldable-viewport-segments.md, #29145) describes a two-pane form beside a reported fold, with the sessions list ending at the hinge. Today the dashboard reads no fold signal at all. On the iPhone Duo half-folded at 951px in Safari it shows the phone layout, because a touch-first mobile browser keeps the phone form at every width (#30619), and that rule has no fold input.Why it matters
Half-folded like a book, the device shows two pages side by side. A one-column phone layout stretched across both bends the transcript through the hinge and hides the sessions list behind a drawer the posture is not made for.
Not a goal
foldHoldsRailCompact,foldCompactRail, thelockedprop onRailBrandToggle) this round. If the maintainers drop item 6 when they rule on the RFC, we delete all three in that round.What changed (motivation → approach → change)
This builds to the precedence rule in #33463, which it depends on: a reported fold at 640px and wider takes the two-pane form ahead of the touch-first phone rule. Until a maintainer signs that line, this PR waits on it.
The RFC on
mainstill readsstatus: draftin its front matter and "- Status: draft. Nothing is built." in its first line, although #29145 merged and bolichen97 signed its direction.website/src/hooks/useViewportSegments.tsholds the fold query,FOLD_TWO_PANE_QUERY(640px and wider), anduseViewportSegments(), which returns the two segments while a fold is reported.website/src/lib/touchLayoutForm.ts:touchFirstForm()returns the two-pane form when that query matches, before its touch check. Every other input gives the same answer as before.website/src/hooks/useIsMobile.tsalso listens to the query, since folding at a fixed width fires no resize.website/src/tailwind-theme.cssandwebsite/src/styles/shell-chrome.css: themdvariant and the top bar's collapse ladder gain the same query, so the styles follow the layout below 768px too. The RFC'sfold-x:variant and fold tokens are left for the first PR that reads them (dialogs and sheets, Phase 2).website/src/pages/chat-sidebar/resize.ts,website/src/pages/chat/sidebarWidth.tsandwebsite/src/pages/ChatSidebar.tsx: while folded the sessions list paints to the leading segment less the rail, and the resize handle and board widening are off, so the saved width comes back when the device is flattened. Folding mid-drag ends the drag (body styles and the dragging flag cleared) and saves nothing.website/src/shell/appShell.tsx,website/src/shell/nav/navRail.tsxandwebsite/src/shell/nav/railChrome.tsx: beside a fold the rail stays compact wherever an expanded rail would leave the leading segment less than the 180px list, and its expand toggle is disabled while that holds.website/src/lib/touchLayoutForm.ts,website/src/hooks/useIsMobile.ts,website/src/pages/chat/page/sessionsDrawer.ts,website/src/pages/chat/page/ChatSidePanels.tsxandwebsite/src/pages/ChatPage.tsx: the side panel, and any app frame in it, stays mounted across a fold. The fold rule above flips the layout form on a touch-first phone at 640px or wider, and that flip used to move the panel from its inline host to the shell's column, mounting a second panel and reloading an open MCP App frame on every fold and unfold. The panel now picks its host from the form the device would have without a fold (panelInlineHost, read from the formuseIsMobilelast committed), so a fold never moves it; a resize across 768px with no fold still moves it in the same commit as the form switch, as on main.src/test/ChatPage.foldAppFrame.test.tsxpins the same iframe node through a fold and an unfold, andsrc/test/panelInlineHost.resize.test.tsxpins the host across a 768px resize and a fold.Backwards compatibility
Compatible: every new rule needs
(horizontal-viewport-segments: 2), which only a foldable reporting a fold matches, and only with the browser's feature flag on today.Removes nothing: on a device that reports no fold every layout decision is unchanged, and all #30619 tests in
useIsMobile.touchForm.test.tspass unchanged.Tests
src/test/useIsMobile.foldTwoPane.test.ts: the Duo half-folded at 951px in a mobile-mode browser gets the two-pane form; flat at 951px it keeps the phone form; a fold at 669px is two-pane on a non-touch device too; below 640px it stays phone; folding at the same width switches the form.src/test/foldSidebarWidth.test.tsandsrc/test/foldLocks.test.tsx: the list width at the fold, right-to-left, the 180px floor, the hidden handle, a board opened while folded, a fold mid-drag, and the disabled rail toggle.src/test/viewportSegmentsParity.test.ts: pins the fold query in the hook, themdvariant and the top bar ladder, and fails on any other segments query undersrc/.src/test/useViewportSegments.test.ts: the hook's readings and listeners.matchMediamocks inApp.foldResize.test.tsxandChatSidebar.createMenu.test.tsxanswered the fold query as matched (one reads only itsmin-widthterm, the other answers every query alike), so they now report no fold, which is what those poses are.useTopbarCollapse.test.tspins the ladder prelude, which now carries the fold term.Each new guard was checked by breaking it on purpose; each break turned a test red.
Determinism: the new tests pass with
--sequence.shuffle.Manual verification
Captured on the iPhone Duo simulator (iOS 27.2, Safari 27.2, both feature flags on), in a Safari tab with demo data only,
mainon the left and this PR on the right. The simulator's Safari reports a coarse pointer, no hover andMobilein its user agent, so it is a touch-first mobile browser.mainshows the phone layout; this PR shows the sessions list beside the chat, its edge at 475.3px against a fold at 475.5px.The built stylesheet grows by about 16 KB raw, 826 bytes gzipped, for the
mdvariant's fold block.Screenshots / video
Half-folded, 951px (
mainleft, this PR right):Flat at 951px and upright at 669px (unchanged)
Related Issues
Part of #29143
Depends on #33463 (the fold precedence line).
Head re-dated to re-dispatch the fork review lanes; tree identical to the Phase 1 commit under #38238, which adopts this sha next.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)