Skip to content

fix(web): keep thread content still while the composer folds - #756

Merged
nixuuu merged 1 commit into
devfrom
fix/web-composer-scroll-reserve
Nov 14, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/web-composer-scroll-reserve

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

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).

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.

The thread reserves the composer's full height plus a 40 px margin, so the composer folds and opens inside that space without moving rows. The fold now follows the reader's scroll instead of toggling.

Related: #738
@nixuuu
nixuuu force-pushed the fix/web-composer-scroll-reserve branch from 823a33c to b2e8615 Compare November 14, 2026 20:57
@nixuuu
nixuuu merged commit c169a46 into dev Nov 14, 2026
12 checks passed
@nixuuu
nixuuu deleted the fix/web-composer-scroll-reserve branch November 14, 2026 21:11
nixuuu added a commit that referenced this pull request Nov 14, 2026
The fade above the composer now starts right at the composer's visible
edge instead of above the whole footer shell. Before, the shell
(including the reserved strip above the composer) was solid surface and
the gradient began only above it, so "Jump to latest" sat on a solid
band with the gradient starting behind it. Now the solid surface covers
only the area below the visible edge (`--feed-edge`, measured by
`footer-edge.ts`), and a 4 rem gradient rises from that edge, so the
button sits on the colour transition — the fade reads as the composer's
shadow.

- The gradient follows the composer's visible edge in every state
(compact, expanded, drafts tab/panels), since `--feed-edge` already
tracks it per frame.
- Colour unchanged: `surface` → transparent (#750).

Related: #750, #756

Checked on the `/dev/long-thread` route in Chromium, dark and light,
scrolled up with Jump to latest visible.

Checks: format:check, lint, web typecheck.
nixuuu added a commit that referenced this pull request Nov 15, 2026
## Change

Running many threads made each renderer fetch background history and
repeatedly reload panels and PR lists. The BFF now materializes
overview, thread metadata and settings from one owner/target-scoped
`WatchOverview`, shares loaded read models and pushes complete
projections over SSE. Ready-key lookup is O(1); response encoding and
list traversal still scale with response size.

- Move bounded history warming to the BFF and remove renderer `/warm`
requests and panel/PR polling. Visible history and older pages remain on
demand.
- Share and reactively refresh panels, PR lists, proxies, model
catalogs, bots and updates. Bound caches/queues and fence old results
across reconnects, sharing resets and target changes.
- Allow independent diagnostics sessions with browser/BFF submission
cooldown, accept GitHub avatar version hashes, and keep infinite
decorative animations out of composer transition controls.
- Update the affected Polish architecture, API, performance,
diagnostics, connector and GitHub docs.

## Verification

- After rebasing onto current `dev`: 17 real-gRPC BFF integration tests
/ 100 assertions passed through `check:tmp`; temporary directory clean.
Web and integration-package typechecks and test-shard ownership check
passed.
- Earlier focused checks passed for diagnostics, avatars/panels,
shared-query invalidation/projection races, gateway/mobile/domain
typechecks, and edited-file lint/formatting.
- Inspected light/dark at desktop and phone widths. Reconnect recovery
and rapid thread navigation worked without page errors.
- Isolated browser probe with 12 synthetic thread submissions: the
observed renderer issued 3 HTTP requests over 12.1 seconds, with no
`/warm`, panel or PR-list requests. This is a synthetic sample, not a
production percentile.
- No user-facing copy changed. Full generated-code checks,
repository-wide checks, remaining test shards and builds are left to CI.

Fixes: #623
Fixes: #569
Fixes: #756
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
nixuuu added a commit that referenced this pull request Nov 27, 2026
## Problem

- Opening a composer tray (tasks, subagents, queue, goal details) moved
the whole thread up with it. Closing the tray snapped the thread back
down.
- After the composer shrank, up to ~120 px of empty space stayed between
the last message and the composer. This happened after sending a
multi-line draft, or when a strip above the composer went away.

## Cause

Both problems come from the feed's end reserve (`footer-reserve.ts`),
introduced in #756:

- **Tray jump.** The reserve counted an opening tray's height. It grew
every frame and pinned a reader at the end, so the rows moved with the
tray. When the tray closed, the reserve shrank in one step and the rows
jumped back.
- **Gap.** The reserve shrank only when it was more than 2 × margin (80
px) too large. Any shrink under 80 px stayed on top of the 40 px margin.

## Changes

- `footer-edge.ts`: footer content marked `data-feed-overlay` no longer
counts towards the reserve. This covers every measurement: the first
one, the ResizeObserver path and the settle path (`reserveHeight`).
- `ComposerPanelBody` (tasks, subagents, queue) and the `GoalBar`
details carry the marker, so these trays open over the thread.
  - Panel headers still count towards the reserve.
- `footer-reserve.ts`: for a reader at the end, the reserve now shrinks
with the footer frame by frame, the same way it grows. For a reader
scrolled up, the reserve keeps the space until they follow the end
again, as before.
- Tray motion is unchanged: it already uses the motion tokens (open on
`--duration-slow`, close on `--duration-medium`, `--ease-smooth-out`).
- Comments in `footer-reserve.ts` and `motion.css` now describe the new
behaviour.

**Trade-off:** an open tray now covers the bottom of the thread instead
of pushing it up. The tray is at most 20dvh. This is how the composer's
own fold already behaves.

## Verification

Tested in Chrome on the dev-only `/dev/long-thread` route with a
temporary footer: a real `TasksPanel` above a resizable composer box,
using the same `footerFit` as the thread page. The temporary changes are
not in this PR. Positions were traced every frame:

| Scenario | Before | After |
|---|---|---|
| Tray open, then closed (last row's top) | 636 → 543 px with the tray,
then a jump to 627 px | stays at 636 px |
| Composer grows by 64 px, then shrinks back (gap to composer) | 96 →
160 px | 96 px, rows glide down with the composer |
| Reader scrolled up, composer grows and shrinks (row position) | — |
stays at 259 px |

- Local checks: `oxlint` on the edited files and `svelte-check` for
`apps/web` both pass.
- Left to CI: the full gate.
- No test added: the repo rules exclude web UI tests.

**Copy audit (docs/copy.md §8):** not applicable, no UI text changed.

Fixes: #756

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
nixuuu added a commit that referenced this pull request Nov 28, 2026
Slow scrolling let the toolbar drift below the composer and made the
shortcut hint add a whole line when reopening. A large wheel delta could
switch the composer from 150 to 52 px in one frame.

The toolbar now stays aligned with the primary action, and the shortcut
hint folds with the editor. The fold tracks small scroll deltas and
limits how far a large delta can move it per frame. Reversing a gesture
continues from the current geometry. Pausing completes the nearer
endpoint and scrolling back resumes from the distance where the composer
folded.

Fixes: #756

## Verification

- Exercised the thread page against a local gateway and scripted worker
in Chromium at 1200 and 390 px. Checked slow scrolling, a pause inside
the end zone, large wheel deltas, rapid reversals and Jump to latest.
The toolbar stayed within the composer and the feed reserve stayed
constant.
- Checked that a multiline draft survives folding and expands on focus.
With reduced motion, every sampled frame showed one of the two endpoint
heights.
- Web typecheck, targeted lint, formatting and diff checks passed
locally. Repository-wide verification runs in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant