Repository navigation
fix(sidebar): keep a pinned folder header in place when it collapses - #17581
Conversation
f1d1c48 to
d9ce38a
Compare
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check the crew-group collapse ( [DESIGN-REVIEWED] 622e740 Description read[DESCRIPTION-READ] 4fbe99bd48af2d0af010fa69be2fadd28bd1fd09d1d55cda3e75b0cb3af63f0f 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 |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: What this change shipsInventory (6 items) — 6 justifiedIntent: a person who collapses a folder from its pinned list-view header keeps that header where it was on screen, instead of the list jumping. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 622e740 Description read[DESCRIPTION-READ] c6c0a0ca35965781332e3f49d40881bf5db6fd7e38abc87de457368d44be459c That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS A tall pinned folder's collapse leaves the lane blank below its header for about 250 ms before the next folder appears. Watch
[UX-REVIEWED] 622e740 Description read[DESCRIPTION-READ] 31283bb02661863f5f7f7d4e5a23aa8948384b9fa7113d8ebb17dcd23b37bbff That sha256 names everything this verdict read: the PR description, plus the 9 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 |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
d9ce38a to
ba90618
Compare
|
ai-review-disposition target=ux head=ba9061897 UX Review BLOCK on d9ce38a ("the visible session rows probably jump just before the folder closes"): fixed on ba90618. The prediction was right, and recording it showed a second cause the stills hid:
Evidence, committed under
Tests: Backend Tests (Windows) (7) on d9ce38a: |
ba90618 to
e628621
Compare
|
Rebased onto main The conflict was one list: the facade's pinned hook call order in On the new head: |
iamwhatever
left a comment
There was a problem hiding this comment.
[operator: iamwhatever]
Approving at 2ea61ea. Thanks for the careful write-up and the filmstrips.
What I checked:
- Diff read in full:
stickyCollapse.ts, the onetoggleListFolderCollapsepath for both list-view toggles (header button andFolderRail), theFolderBodyopacityaddition. Board view still callstoggleColumnCollapseand ignores the new rail argument;FolderBodyis unchanged while open (opacity: 1). - Arm/disarm logic: expand disarms, a dropped optimistic update times out, a removed folder clears the arm, a detached block is a no-op,
scrollTopclamps at 0. - Tests:
ChatSidebar.stickyFolderCollapse,stickyCollapse,ChatSidebar.collapsedFolderGhostHeight,ChatSidebar.ownerComposition— 4 files, 29 tests pass locally. Removing thearmHoldcall fails the 4 collapse cases, so the suite guards the fix. - Real browser: built this head and ran
scripts/capture-sticky-folder-collapse.mjsin headless Chromium. Header top 125.14 -> 125.14 px with motion on, and 125.14 -> 125.14 px underprefers-reduced-motion. - All PR checks green on this head.
No blocking findings.
In the list view a folder header is sticky inside its folder block. When the block's top had scrolled off the lane, collapsing the folder shrank the block to the header alone without moving the lane, so the header fell to the block's natural top above the lane and every row below jumped up. In the commit that marks the folder collapsed, before that frame paints, the lane scrolls up by the measured distance between the header's painted top and its block's top. The block's top lands where the header was pinned, so the header does not move and the body closes underneath it. Both list-view toggles (the header and the left-edge line) go through one handler; expanding is unchanged. The header's painted top is read at the click and the block's top in that commit: under prefers-reduced-motion the body has already closed by then and the header has fallen to the block's top, while the block's own top has not moved, so the distance is the same with or without the transition. The scroll brings the folder's first rows under the header, so they must already be hidden. FolderBody hid its closed rows with an inherited visibility: hidden, which a row control transitioning all carries through its own 150ms transition, so the rows kept painting for the whole close. FolderBody now also sets opacity: 0 on its box, which is not inherited and hides them at once, on every collapse. Closes kirodotdev#17529
2ea61ea to
e73898a
Compare
|
I ran this branch against one more layout from #17529 and the header still moves there: a folder near the end of the list, with nothing below it to fill the space. Steps, in Chromium on a build of e73898a: seed a 12-session folder, then a 24-session folder A, then a 4-session folder B, and nothing after B. Scroll to the middle of A so its header is pinned, then collapse A from its header toggle. Once the body is gone the list is shorter than the scroll position, so the browser clamps For that case I have a follow-up that holds a scroll floor through the collapse. It's a zero-height anchor at the top of the lane with a 1px absolutely positioned marker, placed so the scroll height can't drop below the anchored position. The marker moves up as the user scrolls up and is removed once the content alone reaches it. I'll open it on top of this PR once this lands, rather than as a competing fix, since your commit-timing and |
|
UX Review, Watch 1 (the pane is blank under the header for about 250 ms): this is the item already answered on UX Review, Watch 2 (no cold read): that read runs only when a maintainer pushes the branch to this repository, so it is a maintainer step. @Pearcekieser thanks for the near-end layout. It matches how the hold works: the lane scrolls once, before the body closes. When nothing below the folder fills the space, the scroll height then drops under the scroll position and the browser clamps Backend Tests (3.12, 2/6) and Windows (2/6) fail on two tests outside this diff (it changes no Python). Both also fail on bare |
iamwhatever
left a comment
There was a problem hiding this comment.
Re-approving on 622e740c2.
e73898a18is2ea61eaf1rebased onto main. The PR patch is byte-identical (code, tests, evidence); the docs row only re-applies to main's restructured feature-map.622e740c2merges main to pick up #17909. The earlier Backend reds weretest_http_server_bind_ratchetandtest_session_control_doc, both main-side and outside this diff.- UX Watch 1 (blank lane during a tall folder's close): accepted as answered. It is the shared
FolderBodyclose timing, out of scope here.
Prior review stands: collapsed header stays the top row within 1px, reduced motion and nested folders covered; expand and board view unchanged.
|
Follow-up for the near-end case discussed above is up as #18130. It adds only the scroll floor on top of this PR's helper, with the Chromium Playwright cases and before/after clips. |
Problem / Motivation
Goal: Collapsing a list-view folder whose header is pinned at the top of the sessions list leaves the collapsed header where it was, with the next folder or session directly below it.
In the list view, scroll into a folder until its header is pinned and its first sessions have scrolled off, then collapse it. The collapsed header vanishes above the top of the list and every row below jumps up by however far you had scrolled into the folder.
Why it matters
Anyone with a folder taller than the sidebar hits this every time they collapse it from the pinned header, which is the natural place to click. The list jumps to an unrelated spot and the folder they just closed is off screen.
Not a goal
FolderBodychanges only in how it stops the closed rows painting (below).What changed (motivation → approach → change)
position: stickyinside its folder block. Collapsing shrinks the block to the header alone but leaves the lane'sscrollTopalone, so the header falls back to the block's natural top, which has scrolled above the lane.The new
website/src/pages/chat-sidebar/stickyCollapse.tsholds that one rule (holdPinnedHeaderThroughCollapse). After the scroll the block's top sits where the header was painted, so the header does not move and the body closes underneath it. Because the gap is measured, the same rule works for a nested header pinned below its parents and for a header that the end of its block is already pushing up. A header at its natural place (gap 0) leaves the lane untouched.When the scroll runs matters as much as how far. The scroll brings the folder's first rows under the header, so it must land in the same frame that hides them. The click only arms the hold (
useHoldPinnedHeaderOnCollapse), and a layout effect runs it on the first commit that shows the folder collapsed. That is the commit in whichFolderBodyhides its rows. Where the header was painted is read at the click, and the block's top in that commit. With motion on the body still has its open height in that commit; underprefers-reduced-motionthe transition is zeroed, the body is already closed and the header has fallen to the block's top. The block's own top does not move as its body closes, so the distance is the same either way. Scrolling in the click handler painted the folder's first rows under the header until the optimistic collapse reached React, which is the row swap the UX review predicted.Moving the scroll was not enough on its own.
FolderBodyhid its closed rows withvisibility: hidden, which is inherited, and the row controls transitionallover 150ms, so each one carried the inherited value through its own transition and the rows kept painting for the whole close. That affects every folder collapse, pinned or not.website/src/components/FolderBody.tsxnow also setsopacity: 0on its box:opacityis not inherited, so the rows stop painting at once.visibility: hiddenstays for hit testing and the accessibility tree, and the rows stay mounted for keyboard navigation.In
website/src/pages/ChatSidebar.tsxboth list-view toggles, the header button and the left-edgeFolderRail(website/src/components/FolderRail.tsx), now go through onetoggleListFolderCollapsehandler. That handler arms the hold only when the folder is collapsing (an expand disarms it), then calls the existingtoggleCollapse.FolderRail'sonTogglenow receives the click event, so the handler can find the folder block from the pressed control. The board view's rail ignores the argument.docs/feature-map/README.mdlists the new helper on the Session folders row as an internal piece with no new entry point.Backwards compatibility
Compatible: the only interface change adds an event argument to
FolderRail'sonToggle, and both existing callers still type-check (the board caller ignores it).Removes nothing: the change adds a scroll adjustment in the collapse commit and an
opacityvalue on a closed folder body, and takes no path, key or behaviour away.Tests
website/src/test/ChatSidebar.stickyFolderCollapse.test.tsxrenders the real sidebar with a stubbed pinned geometry: the lane scrolled 500px and the block's top 300px above the painted header. It checks that collapsing from the header, and from the left-edge line, movesscrollTopto 200. It also checks that a header at its natural place and an expand both leavescrollTopunchanged. On origin/main a1974e2 the two collapse cases fail withexpected 500 to be 200. A further case checks that the click itself does not scroll and that the onescrollTopwrite happens while the folder body is alreadyaria-hidden; it fails on the previous head d9ce38a (expected 200 to be 500). The file's framer-motion mock now returns one component per tag, so the lane is not remounted on every commit.expected 500 to be 200).website/src/test/stickyCollapse.test.tsalso covers the hook: it holds on the first commit that shows the armed folder collapsed and only once, it uses the header position read at the arm when the collapsed commit measures the header at the block's top (fails on e628621), an arm older thanHOLD_ARM_TTL_MS(a collapse that never rendered) is dropped, an expand before the collapse renders disarms it, anddisarmcancels a pending hold.website/src/test/ChatSidebar.collapsedFolderGhostHeight.test.tsxpins that a closedFolderBodybox carriesopacity: 0as well asvisibility: hidden. jsdom runs no transitions, so this pins only the style; the filmstrips below show the painting.website/src/test/ChatSidebar.ownerComposition.test.tslists the new owner hook in the facade's pinned call order.website/src/test/stickyCollapse.test.tscovers the geometry rule: a nested header pinned one row down, a header being pushed off by its block's end, sub-pixel and missing-element no-ops, and reading only the block's own header, never a nested folder's.npx tsc -bclean, eslint on the changed files,check-phantom-classes,check-theme-colors,check-restyle-ratchetandscripts/check_feature_map.pyclean; vitest undersrc/test/ChatSidebar*,stickyCollapse,FolderBodyandFolderRail: 111 files, 1149 tests passed. The earlier rebase onto 0d885e6 resolved one conflict, the facade's pinned call order, where main removeduseFlatLaneand the new hook keeps its place beforeuseBoardFolderCollapse.--sequence.shuffle(26 tests).vitest relatedforFolderBody.tsx,stickyCollapse.tsandChatSidebar.tsxpassed: 309 files, 4412 tests.tsc -p tsconfig.app.json, the production build and eslint on the changed files are clean.Manual verification
I ran the built SPA in headless Chromium at 1400x900 against the stub dashboard API, with two folders of 40 sessions each. I scrolled the lane 400px, 1200px and 30px into the first folder and clicked its pinned header. With the fix the header stayed at y=125 (its pinned position) every time, and the second folder's header landed directly below it at y=159. With the rule disabled, the same 400px run put the header at y=-271 and the second folder's header at y=125.
Under
prefers-reduced-motion: reduce(the browser context'sreducedMotion), the same 400px run keeps the header at y=125 with this head; e628621 put it at y=-271, the same as main. A nested folder pinned one row below its parent stays at y=157 with this head, with motion on and off; e628621 moved it to y=109 under reduced motion.One accepted trade-off: after a collapse the header is the top row, so an expand right after opens the folder from its header, not at the scroll position inside it that the person had before the collapse.
For the motion,
website/scripts/capture-sticky-folder-collapse.mjsrecords the same collapse (lane scrolled 400px into "alpha folder") in headless Chromium against the stub API. It writes a video and a filmstrip of every compositor frame from about 120ms before the collapse commits to 450ms after it, cropped to the top of the lane. I ran it against a build of the previous head and a build of this head.Screenshots / video
Pinned header before the click (lane scrolled 400px into "alpha folder"):
After collapsing with the rule disabled: "alpha folder" is gone above the lane and "beta folder" has jumped to the top:
After collapsing with this change: "alpha folder" stays as the top row and "beta folder" sits directly below it:
Filmstrip of the collapse on the previous head (scroll in the click handler, rows hidden by
visibilityalone). From about -13ms to 286ms the rows under the header are "alpha session 0, 1, 2", sessions that were not on screen before the click, and only then does the space close:Filmstrip of the collapse with this change. "alpha session 8, 9, 10" stay until the collapse commits, the header never moves, and the space under it is empty while the folder body closes over the shared 150 ms track. The strip crops the top of the lane, and alpha's body (40 rows) is far taller than the lane, so "beta folder" reaches the crop only in the last frames of the close, landing under the header at about 300 ms:
Filmstrip of the same collapse under
prefers-reduced-motion(capture-sticky-folder-collapse.mjs ... reduce). The body closes at once, "alpha folder" stays as the top row and "beta folder" sits directly below it:Recordings of the runs:
temp-screenshots/17529-sticky-folder-collapse/4-collapse-previous-head.webm,temp-screenshots/17529-sticky-folder-collapse/5-collapse-with-fix.webmandtemp-screenshots/17529-sticky-folder-collapse/6-collapse-reduced-motion-with-fix.webm.Related Issues
Closes #17529
Pattern harvest
Not generalizable: this is the only list surface whose rows are sticky inside a collapsible block. The board view's folder headers are not sticky, and other collapsibles do not pin their header.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.