fix(chat): keep latest-turn actions under the reply (BUG-1042)

The BUG-930 pin spacer sat on the last assistant row, pushing its sibling
.message-actions (and follow-ups / delivery card) below half a screen of
empty space. Move the same min-height onto the last turn's entry
(`:last-child:has(.message-assistant)`) with align-content: start so the
rectification grid wrap does not stretch its rows. Hook logic unchanged.

Records BUG-1043 / BUG-1044 (pre-existing, investigating) found during
browser verification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
Jesse_Chen
2026-09-26 10:19:00 +08:00
co-authored by Claude Opus 5.5
parent ac224cef6a
commit 83cce7ad6a
13 changed files with 189 additions and 7 deletions
+7 -2
View File
@@ -1234,9 +1234,14 @@ button:disabled { cursor: default; opacity: .45; }
.message-bubble { overflow: hidden; border: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-canvas-muted); }
.message-assistant .message-bubble { border-radius: 0; background: transparent; padding: var(--space-3) 0; }
/* Last turn fills the remaining viewport so a short reply can still pin its
head at the top. Variables are written by useConversationScrollAnchor. */
.conversation .message-list > :last-child .message-assistant {
head at the top. Variables are written by useConversationScrollAnchor.
The spacer sits on the whole turn entry (assistant row + .message-actions +
follow-ups / delivery card), not on the assistant row, so the actions stay
under the text and the empty space trails them (BUG-1042). align-content
keeps the rectification wrap's grid rows from stretching into that space. */
.conversation .message-list > :last-child:has(.message-assistant) {
min-height: calc(var(--conversation-viewport, 0px) - var(--latest-turn-head-height, 0px));
align-content: start;
}
.message-thinking {
margin: 0 0 var(--space-3);
@@ -84,8 +84,11 @@ export function lastTurnTail(container: HTMLElement): HTMLElement | null {
export function turnHeadHeightForSpacer(head: HTMLElement | null, tail: HTMLElement | null): number {
if (!head) return 0;
// The last assistant carries the min-height spacer. Measuring it as the turn
// head feeds the spacer back into itself (BUG-931).
// The last turn's entry, which starts at this assistant row, carries the
// min-height spacer (BUG-1042). Subtracting the row's own height would leave
// that entry one row short of the viewport; before BUG-1042 the row itself
// carried the spacer and measuring it fed the spacer back into itself
// (BUG-931). Either way the head-is-tail case subtracts nothing.
if (tail && head === tail) return 0;
return head.offsetHeight;
}