Repository navigation
fix(threads): keep the latest control above the composer fade - #738
Merged
Merged
Conversation
nixuuu
force-pushed
the
fix/thread-composer-fade
branch
from
November 14, 2026 16:56
04f3d09 to
4298314
Compare
nixuuu
marked this pull request as ready for review
November 14, 2026 16:57
nixuuu
force-pushed
the
fix/thread-composer-fade
branch
from
November 14, 2026 17:00
4298314 to
3ff6f56
Compare
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Visual fixes from user feedback on the desktop app (dark, nightly), after #738, #740 and #742. Related: #738, #740, #742 ## Changes **1. The fade matches the thread background.** #740 changed the thread area to `surface`, but the fade under the composer still used `canvas`. In dark this showed as a darker rectangle. The fade and the footer backdrop now use `surface`, the same token as the thread area. It only imitates the composer's shadow. In light the two tokens were already equal; in dark they now are too. **2. "Jump to latest" sits just above the composer.** It was placed from the footer top plus the fade, but the footer also reserves an empty 32 px Drafts strip above the composer. So the button floated about 60 px up, over text. It was also centred on the whole feed rather than on the column, which #742 can offset. - Footer content now marks the boxes it actually paints with `data-feed-edge`: the composer surface, the Drafts tab and the panels above it. - `footer-edge.ts` measures the topmost one (ResizeObserver + MutationObserver, batched per frame). The button sits 8 px above that edge, in the shared `.chat-column`. - When the button sticks out above the footer (panels or Drafts showing), the fade grows to cover it. **3. The summary card sizes to its content.** The docked card is now `top-0 max-h-full`: as tall as its content, at most to the bottom of the thread area (12 px inset), and it scrolls inside. #742's centring and docking logic is unchanged. **4. Tabs.** - The strip has no box of its own. Only the active tab is a `surface`, with 8 px top radii and reverse corners. The corners use a 1 px soft edge, so they have no stair-steps at DPR 1 or 2. The active tab and the content below form one surface. - Inactive tabs are muted text on the chrome. Hover shows a quiet inset pill. - A 1 px separator sits only between two inactive tabs and hides on hover. - The preview tab is italic, with a little padding so the slanted last glyph isn't clipped. **4b. The gap before `⋯`.** `ThreadSyncProgress` always rendered a fixed `w-16` slot, so the header kept an empty 64 px gap before `⋯`. It now renders only while syncing. It appears on the tab side, so the right-aligned actions never move. The Windows/Linux window-control reserve is unchanged: it was already scoped to those platforms and releases when a side panel owns the edge. **5. The whole summary header collapses the card.** The header is `<h2><button aria-expanded aria-controls>` (disclosure pattern; one control, no nested buttons). It collapses the docked card or closes the popover, and focus returns to the pill. - It has hover and press feedback and an inset focus ring. - A press that turns into a drag or a text selection does not toggle. - At phone width the summary still opens as a sheet, with the sheet's own close. Docs: `ui-scale.md` (fade, button anchor), `workspace.md` (card height, tab surfaces). ## Verification - `bun install`, `gen:check`, `typecheck`, `lint`, `format:check` and the web build all pass (with `nice`, temp files in `/var/tmp`). - **Review host** with the bench stack (synthetic workspace files) and Playwright, comparing before and after in light and dark. Layouts: 1100 (pill), 1280 (expanded composer), 1440 (card docked and collapsed), 1920 (sidebar off; Files open), 2560 and 390. - **Fade:** its colour equals the thread background in all 24 layouts. Before, every dark layout differed: `rgb(23,25,20)` vs `rgb(32,33,28)`. - **Jump to latest:** before, it sat 63 px above the composer (78 px when expanded) and up to 171 px off its axis. After, it is 8 px above the composer surface and 0 px off its axis everywhere (0.5 px at 390). - **Card:** before, it was always as tall as the area (828/1008/1368 px). After, it is 410 px, its content height. At a 460 px viewport it caps at 388 px, ends 12 px above the bottom and scrolls. - **No horizontal scroll** (`scrollWidth` equals the viewport width) in any layout. - **Tabs:** checked at DPR 1 and 2 in both themes, with Thread, two kept files and an active preview file, plus hover. The reverse corners show no seams. - **Summary header:** a drag across it doesn't toggle. Click, Enter and Space close it in both the docked (1440) and popover (1100) variants, and focus returns to the pill. Keyboard focus is `:focus-visible` with the ring inside the card. - **Not checked:** native Windows/Linux window controls (CSS reserve unchanged) and the macOS app itself. - No UI test suites added. ## Copy audit (§8) No visible text changed. The header button's accessible name stays `Collapse thread details` / `Close thread details` (the former icon button labels) and contains the visible "Thread details" (label in name).
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
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
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
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.
The compact composer used a fixed fade, while Jump to latest lived on a separate fixed rail that could sit beneath the footer or disappear when the composer expanded.
The fade now uses 12.5% of the measured footer height, clamped to 12–32 px, and the thread canvas token in both themes. Jump to latest shares the composer's containing block, sits 8 px above the fade with an opaque surface, border and shadow, and follows the measured footer in both composer states. Its existing token-based rise transition remains outside layout; the composer content keeps its clipping independently.
Mobile uses the existing JS/Reanimated stack: a 16–32 dp fade follows the fold progress, and Show latest sits above the visible measured stack, outside its clipping and scroll reserve. It remains available while the composer is expanded. No dependencies, native configuration, EAS commands or publication changed.
Fixes: #578
Related: #734
Validation
bun install, full workspacebun run typecheck,bun run lint,bun run format:check, andbun run --filter @canopy/web build. Commands usedniceand temporary files under/var/tmp.expo exportwith Hermes bundles. These validate JS packaging; native device behavior was not exercised.CI on the first revision also reported a failure in the untouched
tests/integration/proxy-accounts.test.ts:180(expected five accounts in stateok, received an empty response). The final head starts a fresh CI run; its result is still pending at handoff. The initial static-check failure was the mobile function-size/spacing finding, corrected and verified by the final local lint run.Copy audit (§8)
No UI text changed. Existing action labels remain Jump to latest and Show latest messages. Polish UI-scale and mobile documentation now describe the proportional fade and measured anchor.