Repository navigation
fix(web): move the thread column with the sidebar in the same frame - #755
Merged
Merged
Conversation
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Fixes user feedback from the desktop app (nightly): when the composer switched between compact and full, the thread content moved on the Y axis together with the composer's animation. Related: #738 ## Changes **1. A fixed end reserve.** The space under the rows (the spacer in `VirtualFeed`) is now the composer's *full* height plus a 40 px margin (Y). It is not the composer's current height. - The composer compacts, expands and morphs inside the reserve. No row, scrollTop or virtual window changes during the morph. - The margin absorbs one more strip, such as a queued item, the subagents strip or an attachment row, without a recompute. - The reserve grows only when the full height goes past it (a long draft, attachments, a new strip). It grows in the same frame: - a reader following the end stays exactly at the end; - any other reader keeps their scrollTop. - It shrinks only once the reader is back at the end. This keeps a reader who scrolled up from being clamped. - The old FLIP translate of the whole content (`footer-motion.ts`) is removed. - `footer-reserve.ts` holds this logic. While compact, the full height is the last expanded height plus any growth in the compact state. A thread that reopens compact starts from the last full height measured. **2. The fold follows the scroll.** `composer-compaction.ts` now produces a progress value from 0 (full) to 1 (compact) instead of a toggle. - Reading up 96 px folds the composer linearly with the scroll. Once folded, it stays folded. - In the last 192 px before the end, it opens in step with the way back. - `composer-morph.ts` flips `compact` once. It keeps the CSS transitions that the flip starts, pauses them, and seeks them to the progress: one `currentTime` write per frame, with linear easing while scrubbing. There is no JS layout and no per-frame read-after-write. - The thread slot re-enables the composer's own layout transitions for this; the FLIP used to replace them. - Scroll-driven CSS animations are not used: the progress depends on travel and on a latched state, not on the scroll position alone. - After the reader stops (240 ms, because Chrome fires `scrollend` after every wheel notch), the nearer state finishes. Focus, typing and Jump to latest open the composer at the transitions' own pace. - Under `prefers-reduced-motion`, the state switches only at either end, with no tween and no shift. **3. Built on #750's `footer-edge.ts`.** `watchFooterEdge` is now the single footer observer. It reports the visible edge (Jump to latest, fade) and the footer height (reserve). - It measures resizes inside the ResizeObserver callback, where layout is clean. The button and fade follow the morph in the same frame, without a one-frame lag or a forced layout. - #750's behaviour is kept: the fade uses `surface`, and the button sits 8 px above the composer's visible edge, centred on the composer. - The footer markup keeps #750's nesting. Only the shell's inner box is now in flow, so the shell takes the composer's natural height. `ComposerFold` (`composer-fold.svelte.ts`) wires these together for the thread page. `docs/ui-scale.md` describes the reserve and the scroll-linked fold. ## Measurements These ran on the review host with the bench stack (`scripts/bench/client-stack.ts`, 1000-turn synthetic thread) and Playwright Chromium. "Shift" is the per-frame movement of a visible row that the scroll does not explain: Δrow top + ΔscrollTop. | Scenario | Before (dev) | After | |---|---|---| | Scroll back to the end (composer opens) | **97–118 px** jump, then a slide back | **0 px** | | Typing a multi-line draft at the end | content slides with each line (19–24 px per frame) | 0 px; stays at the end | | Scroll up from the end, focus to expand | 0 px | 0 px | | Streaming: last row under the composer on a growth frame | up to −52 px (−69 with a draft) | −12 px (one frame per paragraph) | | Composer height over four 60 px wheel notches | 238 → 238 → 238 → 238 → 120 (toggle) | 238 → 205 → 166 → 128 → 120 | Shift was 0 px in every phase at 1100×800 light, 1440×900 dark, 2560×1440 light and 390×844 dark, and with reduced motion. **Frame times (rAF intervals over the whole probe, ~670 frames):** - before: avg 16.74–16.81 ms, p95 16.7–16.8 ms; - after: avg 16.67–16.84 ms, p95 16.7 ms. Isolated long frames (33–117 ms) appear in both runs. A trace of repeated focus expansions showed no long task; the one-off is the first focus. **Anchoring (#750):** "Jump to latest" is 8 px above the visible edge (7.6–8.4 px mid-scrub), 0 px off the composer axis, at 390, 1100, 1440 and 2560 in both themes. The fade colour equals the thread surface in both themes. **Streaming:** send, queue a follow-up, attach a file and write a multi-line draft at the end (composer 238 → 461 px). The reader stays at the end through all of it; the composer folds and reopens mid-stream. At 390 px, ending a turn with a steer can move the reader to the start of an answer taller than the visible area. This is the existing answer-start alignment: the threshold now uses the reserve, which is the real visible space at the end. ## Not covered - The subagents strip itself (the fixture has no subagents). The queue strip covers the same path. - An empty thread (the fixture has none). The short 1-turn thread was checked. - Native desktop app and real touch devices. - Mobile (React Native) is unchanged. No UI test suites added. ## Checks `bun install`, `gen:check`, `typecheck`, `lint`, `format:check` and the web build pass (with `nice`, temp files in `/var/tmp`). ## Copy audit (§8) No UI text changed. `docs/ui-scale.md` (Polish) describes the reserve and the scroll-linked fold. ## Rebased on #755 (sidebar column in CSS) #755 touched `motion.css` and the thread page too. There was no textual conflict and no overlap in behaviour. The footer sits inside `.chat-column`, so it moves with #755's CSS placement. The morph only captures transitions inside the composer's own subtree, so a sidebar toggle and a scroll-linked fold can't capture each other's animations. I re-ran the probe on the review host (bench stack, dev mode). It added a sidebar toggle in three states: pinned at the end, compact while scrolled up, and with a multi-line draft at the end. It also recorded the painted jump-button gap from a ResizeObserver created after the app's. | | 1440 dark | 1440 light | 390 dark | 390 light | |---|---|---|---|---| | Max content shift, all phases incl. sidebar toggles | 0 px | 0 px | 0 px | 0 px | | Composer height during toggles | steady | steady | — (drawer) | — (drawer) | | Jump button: gap above visible edge (painted) / off-axis | 7.5–8.5 / 0 px | 7.5–8.5 / 0 px | 7.6–8.5 / 0 px | 7.5–8.5 / 0 px | | Reader pinned at the end during a toggle | stays at end | stays at end | — | — | The same probe on plain `dev`: - 96.6 px shift on the way back to the end; - painted jump gap −110 / +126 px while the composer changes state. The long frames on sidebar toggles in dev mode (150–517 ms) are identical on plain `dev` and on this branch. Checks after the rebase: `bun install`, `gen:check`, `typecheck`, `lint`, `format:check` and the web build pass.
This was referenced Nov 16, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 26, 2026
## Change - Determine summary docking and the side panel's placement from their target widths. Use ResizeObserver data for the live floating-summary breakpoint. Keep the existing CSS transitions for the sidebar, side panel and summary. - Prepare the composer's paused transitions once per scroll segment. Subsequent frames only seek those transitions to the current scroll progress. ## Verification - Headless Chromium with a seeded Canopy workspace. Six sidebar toggles produced 1,029 geometry reads on the observed columns before the change and zero after. Width samples matched. The p95 requestAnimationFrame interval was 16.7 ms in both versions. - A controlled Chromium composer comparison matched all 25 samples, including reversal and settlement. Animation pause calls fell from 63 to 18 with the same number of seeks. Checked folding and reopening in the live workspace. - Checked the summary and side panel at 1,440 px and 410 px, and confirmed navigation restores each thread's panel state without a grid transition. - Web typecheck, lint on changed code, and diff checks passed locally. Repository-wide verification runs in CI. Frame presentation in Electron at 120 Hz remains unmeasured. Refs: #755 Refs: #756 Related: #1294
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.
Problem
On desktop, opening or closing the left sidebar made the thread content jump. A frame-by-frame look at the user's video (60 fps) shows the cause: on close, the message column first slid left with the sidebar edge, overshot by about 100 px, and then drifted back right to its centre over about 300 ms.
#742 placed the column with
--chat-offset/--chat-column, whichSummaryLayoutcomputed in JS from a ResizeObserver. During the sidebar's width tween, that offset always landed at least one frame behind the sidebar. Each frame, the column moved with the area's edge and then snapped back, so it oscillated. Headless measurement at 1512 px: a column that should not move at all moved up to 59 px per frame, with 3–11 direction reversals per toggle.Two related flips mid-tween:
widelikewise used the live width.Change
Column placement is CSS.
[data-chat-placement] .chat-columncomputes itsmargin-leftandmax-widthfrom:--sidebar-extent),100%),--chat-card-space).The rule is the same: centred on the window, clamped between the area's start (sidebar plus turn rail) and the card, narrowing only when it must. There is no JS round trip, so the column moves in the same frame as the sidebar and Files.
One timing for the sidebar and the column.
--sidebar-extentand--chat-card-spaceare registered, non-inherited properties. The sidebar column (t-sidebar) and the chat columns ease their own copies with the same start, duration and curve:--duration-slow; close:--duration-medium; curve:--ease-smooth-out;--duration-slow.Only those few elements restyle per frame. A first version animated an inherited property on the shell root, which restyled the whole page and doubled dropped frames; it was replaced.
--sidebar-widthscope. It is set only on the sidebar column and the thread area, not the shell root, so drags don't restyle the whole page either.Layout decisions use the end state.
sidebarTravel()andThreadWorkspace.travel()add the distance the sidebar and Files still have to travel to the measured width. So the docked card vs pill, and Files beside vs over the thread, switch once at the start of the easing and never mid-way. Files' width/draft moved intoThreadWorkspacefor that.Reduced motion: all of these change at once.
Narrow widths: the drawer below
lgis unchanged (--sidebar-extentis 0 there).fix(workspace): polish the composer fade, summary card and tabs #750's "Jump to latest" shares
.chat-column, so it follows the same placement. Itsriseis a keyframe animation, so there's no conflict.Docs:
workspace.md(placement in CSS, end-state docking, sidebar motion).Related: #740, #742
Verification
bun install,gen:check,typecheck,lint,format:checkand the web build pass (withnice, temp files in/var/tmp). The fullcheck:tmptest run was not run: the change is web CSS/Svelte only, which no test suite covers.devvs this branch, headless Chromium. A rAF probe records the sidebar width, column, composer, card and Files grid every frame across 6 toggles per layout:100%excludes the feed's scrollbar gutter, where the old JS measure included it. macOS overlay scrollbars are unaffected.No UI text changed, so no copy audit is needed.