Repository navigation
fix(sidebar): close a pinned folder in one frame so the lane is never blank - #18057
Conversation
…er its header is never blank Collapsing a tall folder from its pinned header left the lane under the header empty for about 250 ms. FolderBody faded the rows out at once while the 150 ms track kept almost its full height, and the next folder's rows then slid up through layout projection. A collapse that starts from a pinned header now takes the reduced-motion path for that commit: the body closes with no transition and the session rows are out of layout projection, released two frames later. A header at its natural place keeps the animated close. The opacity snap is gone. Closes kirodotdev#18052
|
First-pass check: R1-R8 OK.
@Pearcekieser, this does not touch the scroll position or |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The only check that the rows stop sliding after the two-frame release is #18052's filmstrip. The unit test fakes What this change shipsInventory (6 items) — 6 justifiedIntent: when someone collapses a folder from its pinned header, the next folder shows up under that header at once, with no ~250 ms blank lane. This is a FIX (closes #18052).
[FIRST-PRINCIPLES-REVIEWED] 9ebe283 Description read[DESCRIPTION-READ] 24daf16c5fa9b3ed8d598d12497fd7b5d8e988e4a09d9d507b506f5b5c01b9f2 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Watch the motion-on recording: frames 45–77 ms of filmstrip 1 still show an empty lane under "beta folder". That gap is left to #18121. [UX-REVIEWED] 9ebe283 Description read[DESCRIPTION-READ] c988b5f3a6d7e18033a4770083186121b952bc95fe265b5d4faaccdbfd878f19 That sha256 names everything this verdict read: the PR description, plus the 5 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 |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check in a real browser that switching all rows' Framer [DESIGN-REVIEWED] 9ebe283 Description read[DESCRIPTION-READ] 6d15117fff57a7b028fb07a395b41b5cd0c5f57b6ac8a39bce3bdb58fb91cd10 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 |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
ai-review-disposition target=first-principles head=9f0a9928ee Fixed on 9f0a992: the single blocker, item 3.
First-pass check: R1-R8 OK. |
|
ai-review-disposition target=ux head=9f0a9928ee Evidence gap (unpinned, board and Watch (rows paint at 95 ms): agreed, the description over-claimed. It now says "beta folder" is under the header from 45 ms and its sessions paint at 95 ms. The same gap shows on main's existing reduced-motion collapse (filmstrip 2: empty lane at 24 ms, rows by 86 ms), and this PR does not change that path, so the gap does not come from the transition. It is filed as #18121 with the likely cause ( First-pass check: R1-R8 OK. |
|
ai-review-disposition target=design head=9f0a9928ee Watch 1 (opacity removal out of scope): cleared by its first condition. The opacity change is dropped on 9f0a992, and Watch 2 (remaining blank under the next folder, frame timings): the description's timings now match the committed filmstrip. The collapse commits between 28 and 45 ms, "beta folder" sits under the header from 45 ms, and the sessions paint at 95 ms. Main's reduced-motion collapse, which this PR leaves alone, shows the same short gap, so it does not come from the transition change. It is tracked in #18121 (likely First-pass check: R1-R8 OK. |
|
CI on 38425b4, disposition for head 9f0a992
|
FolderBody hides the closing rows with `opacity: 0` again, so every animated close (unpinned list headers, the board view, CrewGroups, DesignTweakPage) paints exactly as it does on main. Only a collapse from a pinned header changes: it closes with no transition, which on its own leaves no closing frame for the lane to read as blank. useHoldPinnedHeaderOnCollapse goes back to its place in the facade's pinned owner-hook order, and rowAnimEnabled is derived right after it.
9f0a992 to
9ebe283
Compare
|
Disposition for head 9ebe283 (follow-up to the independent review of 9f0a992) First-pass check: R1-R8 OK.
Lane notes on 9ebe283, all PASS:
Tests run on 9ebe283: |
iamwhatever
left a comment
There was a problem hiding this comment.
This PR fixes the ~250 ms blank lane after you collapse a folder from its pinned header, and it fixes the root cause. The animated grid-template-rows close was shrinking an empty track under a header the hold keeps still, and Framer projection then slid the next folder up from far below. For that one collapse commit, the PR reuses the existing reduced-motion path: FolderBody gets transition: none, and rowAnimEnabled is off while instantCloseId is set. Every other caller keeps the animated close and the opacity snap byte-for-byte. I read the full production diff (stickyCollapse.ts, FolderBody.tsx, ChatSidebar.tsx) and traced how instantCloseId is released. It clears after two rAFs once the collapse renders, on re-arm and disarm, when the folder is seen open, when the folder is gone, and through a per-arm TTL timer that only clears its own arm, so projection cannot stay off. The tests pin the pinned path in the collapsed commit, the natural-place 150 ms close (read with a MutationObserver before any frame), and the TTL release, and the author reports mutation checks. All checks on head 9ebe283 are green, and GPT, Opus, Design, UX and First Principles all PASS. Earlier design, UX and first-principles concerns got dispositions, including dropping the out-of-scope opacity change. This is a fork PR, so the committed temp-screenshots evidence is the allowed path. — crew-pr-reviewer
Problem / Motivation
Goal: Collapsing a folder from its pinned header closes it in one frame, so the next folder is under that header at once instead of after a ~250 ms blank lane.
After #17581, collapsing a tall folder from its pinned (sticky) header keeps the header in place, but the lane under it is empty for about 250 ms. In #17581's filmstrip (
temp-screenshots/17529-sticky-folder-collapse/5-collapse-with-fix-filmstrip.png), the rows stop painting at about 42 ms and "beta folder" appears at about 297 ms. #17581's UX lane raised it, and #17581 merged without the fix, so the fix is this follow-up.Why it matters
The person was reading a folder and asked to fold it away. For a quarter of a second they see an empty sidebar, which reads as lost content or a broken render.
Not a goal
CrewGroupsandDesignTweakPageclose exactly as on main, including the opacity snap that fix(sidebar): keep a pinned folder header in place when it collapses #17581 chose.scrollTopclamps when little content sits below the folder. This PR does not touch the scroll position or the hold.content-visibility: autoon.session-row, not confirmed).onMutateawaitscancelQueriesfirst, soinstantCloseIdcommits one render before the collapse. Projection is off for that commit, but nothing moves in it.What changed (motivation → approach → change)
The symptom was a blank lane under a held header for about 250 ms, and it came from the animated close. The hold scrolls the lane so the header stays still. The 150 ms
grid-template-rowstrack then shrinks under a header that does not move, and with the rows hidden at once (the opacity snap), that shrinking track is empty space. After that, the next folder's rows slid up through Framer layout projection (rowAnimEnabled) from hundreds of px below.Change: a collapse that starts from a pinned header takes the reduced-motion path for that one commit.
useHoldPinnedHeaderOnCollapse(stickyCollapse.ts) decides at the click, from the same header reading the hold uses, whether the header is pinned, and exposesinstantCloseId. It is committed before the collapse, so the collapsed commit already carries it.FolderBodytakesinstantClose: while closed it usestransition: none. Opening always animates. The opacity snap stays.ChatSidebarpassesinstantCloseto the list view's folder body and setsrowAnimEnabled = !reduceMotion && instantCloseId === null. The hook keeps its slot in the facade's pinned owner-hook order (ChatSidebar.ownerComposition.test.ts).instantCloseIdis released tworequestAnimationFrames after the collapse commit, so later reorders animate again. Releasing cannot animate anything, because the track is already at0fr. It is also cleared by the next arm,disarm, the folder being seen open from any control, and a dropped arm. A dropped pinned arm is released by its ownHOLD_ARM_TTL_MStimer, so projection never waits on a laterfolderschange.Why not keep the animation and fade the next folder in? The space would still be empty while the track shrinks. Only closing in one frame removes the shrinking track.
Why not drop the opacity snap instead? That changes every animated close for every
FolderBodycaller, and #17581 chose the snap on purpose. With no transition, the pinned path has no closing frame to paint, so the snap no longer matters there.Why decide at the click? The collapsed commit is the frame that must already have no transition, so the flag has to exist before it renders.
Why not a new mechanism? Both switches already exist as the reduced-motion path (
transitionandrowAnimEnabled). This reuses them for one commit.Design note (R3):
instantCloseIdhas one writer, the hook. The release frame and the TTL timer are cancelled on re-arm, disarm and unmount, and the timer acts only on the arm that set it, so a stale release cannot clear a newer arm. No state crosses processes or awaits.Backwards compatibility
Compatible:
instantCloseis optional and defaults to the animated close. Every otherFolderBodycaller is unchanged. Removes nothing.Tests
ChatSidebar.stickyFolderCollapse.test.tsx:none, every session row haslayout=false, and projection comes back afterwards;noneunderprefers-reduced-motion;stickyCollapse.test.ts:instantCloseIdis set only for a pinned header; it clears when seen open, on disarm and on a dropped arm; it releases on the second frame, not the first (requestAnimationFramefaked); a pinned arm that never renders collapsed is released atHOLD_ARM_TTL_MSwith nofolderschange, and a later arm outlives an earlier arm's timer.ChatSidebar.collapsedFolderGhostHeight.test.tsx: the existing opacity-snap pin is kept unchanged, plus aninstantCloseunit test.The new tests fail on origin/main. Mutation pins: removing
transition: none, always taking the instant close, dropping the seen-open clear, releasing after one frame, never releasing, dropping the TTL timer, forcingpinned = true(fails the natural-place integration test), and leaving rows projected each turn a named test red.Run on this head:
npx vitest runover allsrc/test/ChatSidebar*.test.ts*,src/pages/chat-sidebar/*.test.ts*and every test namingFolderBody,stickyCollapseorrowAnimEnabled(183 files, 2641 tests passed);npx tsc -b;npx eslinton the changed files;scripts/check_comment_history.pyandscripts/check_brand_name.py.Manual verification
Built the SPA and ran
website/scripts/capture-sticky-folder-collapse.mjsagainstvite previewon 127.0.0.1, with motion on and withreduce. The header top is 125.14 before and after in both runs.Screenshots / video
With motion on, the collapse commits between the 28 ms and 45 ms frames. "beta folder" is under the pinned header from 45 ms, nothing slides afterwards, and its sessions paint at 95 ms (see Not a goal). On #17581's head, "beta folder" first appears at about 297 ms.
Under
prefers-reduced-motionthis path is the same as on #17581.Recordings:
temp-screenshots/sticky-collapse-blank-lane/1-collapse-pinned-tall-folder.webm,temp-screenshots/sticky-collapse-blank-lane/2-collapse-pinned-tall-folder-reduced-motion.webm.Related Issues
Closes #18052. Follow-up to #17581 (closes #17529). Leaves #18121 open.
Pattern harvest
Rule candidate: review-prompt
Pattern: "a size transition under a scroll-held sticky header shrinks space the reader is looking at; close it in one frame on that path rather than restyling the shared animated close"
Checklist
FolderBody.tsxandstickyCollapse.ts; no feature-map row changesContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.