Skip to content

Commit 5b0c094

Browse files
authored
feat(ui): stack the docked progress card under the suggestion tray (#129443)
The suggestion tray and the docked progress card both floated over the conversation's top-right area as independent absolutely-positioned elements. The tray is 450px at z-index 24 and the card sat at z-index 3, so whenever a suggestion arrived while a plan was live the tray covered the card outright: session state disappearing with no trace, which is the failure mode this repo weighs heaviest. Give the gutter a single owner. .chat-gutter-stack is one absolutely positioned column at top-right; the tray and the card become its children and cannot overlap by construction. The tray keeps its exact geometry (same inset, same width, position: relative only so its stacked -card shadow still anchors to itself); the card right-aligns beneath it. The card is now top-anchored rather than pinned to the composer's bottom edge, so appended steps and a longer note extend downward instead of shifting the rows already being read, and the empty gutter falls below the card instead of above it. Its width becomes a fixed token rather than gutter-derived arithmetic: the pane already gates this placement on a measured gutter wide enough to hold it, so the clearance is guaranteed and a stable card beats one that grows with the window. Covered by a new placement case asserting the card sits fully below the tray when both render.
1 parent 3626a8e commit 5b0c094

5 files changed

Lines changed: 135 additions & 40 deletions

File tree

‎ui/src/e2e/session-progress-live-placement.e2e.test.ts‎

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,15 @@ suite.define(() => {
136136
const composerBounds = await visiblePane
137137
.locator(".agent-chat__composer-shell")
138138
.boundingBox();
139-
if (!dockBounds || !composerBounds) {
139+
const threadBounds = await visiblePane.locator(".chat-thread").boundingBox();
140+
if (!dockBounds || !composerBounds || !threadBounds) {
140141
return false;
141142
}
143+
// Clear of the centered composer, and anchored to the top of the
144+
// conversation rather than floating above the composer.
142145
return (
143146
dockBounds.x >= composerBounds.x + composerBounds.width &&
144-
Math.abs(
145-
dockBounds.y + dockBounds.height - (composerBounds.y + composerBounds.height),
146-
) <= 1
147+
dockBounds.y < threadBounds.y + threadBounds.height / 2
147148
);
148149
})
149150
.toBe(true);
@@ -193,6 +194,80 @@ suite.define(() => {
193194
);
194195
});
195196

197+
it("stacks the docked card under a suggestion tray instead of letting it be covered", async () => {
198+
const sessionKey = "agent:main:progress-stacked";
199+
await suite.withPage(
200+
{
201+
colorScheme: "dark",
202+
locale: "en-US",
203+
serviceWorkers: "block",
204+
viewport: { height: 900, width: 1600 },
205+
},
206+
async ({ page }) => {
207+
await installMockGateway(page, {
208+
featureMethods: [
209+
"chat.metadata",
210+
"chat.startup",
211+
"progressCard.get",
212+
"taskSuggestions.list",
213+
"taskSuggestions.accept",
214+
"taskSuggestions.dismiss",
215+
],
216+
methodResponses: {
217+
"progressCard.get": {
218+
card: {
219+
revision: 1,
220+
sessionKey,
221+
steps: [
222+
{ step: "Inspect", status: "completed" },
223+
{ step: "Implement", status: "in_progress" },
224+
],
225+
updatedAt: 1,
226+
},
227+
},
228+
"taskSuggestions.list": {
229+
suggestions: [
230+
{
231+
id: "task_stacked",
232+
title: "Follow-up worth keeping",
233+
prompt: "Inspect the related implementation and tests.",
234+
tldr: "This tray must not cover the progress card.",
235+
cwd: "/projects/example",
236+
sessionKey: "main",
237+
agentId: "main",
238+
createdAt: 1,
239+
},
240+
],
241+
},
242+
"sessions.list": chatSessionListResponse([
243+
{ key: sessionKey, kind: "direct", label: "Stacked progress", updatedAt: 1 },
244+
]),
245+
},
246+
sessionKey,
247+
});
248+
249+
await page.goto(controlUiSessionUrl(suite.server.baseUrl, sessionKey));
250+
const visiblePane = page.locator("openclaw-chat-pane.chat-pane-cache__pane--visible");
251+
const tray = visiblePane.locator(".task-suggestions");
252+
const dock = visiblePane.locator('[data-progress-card-placement="dock"]');
253+
await tray.waitFor({ state: "visible", timeout: 10_000 });
254+
await expect.poll(() => dock.count()).toBe(1);
255+
await expect
256+
.poll(async () => {
257+
const trayBounds = await tray.boundingBox();
258+
const dockBounds = await dock.boundingBox();
259+
if (!trayBounds || !dockBounds) {
260+
return false;
261+
}
262+
// The card sits fully below the tray, not underneath it.
263+
return dockBounds.y >= trayBounds.y + trayBounds.height;
264+
})
265+
.toBe(true);
266+
await captureProof(page, "stacked-under-tray.png");
267+
},
268+
);
269+
});
270+
196271
it("centers the completed marker and dismisses the card across disclosure and reload", async () => {
197272
const sessionKey = "agent:main:progress-complete";
198273
const plan = [

‎ui/src/pages/chat/chat-pane-rails.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ type ChatPaneGatewaySnapshot = Parameters<typeof isDesktopPanelAvailable>[0];
1616

1717
export type ChatProgressCardPlacement = "composer" | "dock" | "rail";
1818

19-
/* Narrowest gutter that still holds a readable card: the dock keeps a 12px gap
20-
* from the composer and clears the transcript scrollbar strip on the far side,
21-
* so this leaves it ~250px of its own. */
19+
/* Narrowest gutter that still clears the composer: the dock is a fixed
20+
* --chat-progress-dock-width (250px) inside .chat-gutter-stack, which holds it
21+
* 14px off the pane edge and a --space-3 gap clear of the composer. */
2222
const PROGRESS_CARD_DOCK_MIN_GUTTER_PX = 280;
2323

2424
/** Picks the single live progress-card placement for one chat pane. */

‎ui/src/pages/chat/chat-view.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,18 @@ export function renderChat(props: ChatProps) {
479479
onRemoveAttachment: props.onRemoveAttachment,
480480
onOpenImage: openImmediateImage,
481481
});
482+
const taskSuggestionTray = renderChatTaskSuggestionTray(props);
483+
const dockedProgressCard =
484+
props.progressCard?.placement === "dock"
485+
? renderSessionProgressCard(props.progressCard.card, "dock", props.onDismissProgressCard)
486+
: nothing;
487+
// One column owns the conversation's top-right gutter. Both members float over
488+
// the transcript, so sharing a stack is what stops the wider suggestion tray
489+
// from silently covering the progress card when they appear together.
490+
const gutterStack =
491+
taskSuggestionTray === nothing && dockedProgressCard === nothing
492+
? nothing
493+
: html`<div class="chat-gutter-stack">${taskSuggestionTray}${dockedProgressCard}</div>`;
482494
const scrollToBottomButton =
483495
props.showNewMessages && props.onScrollToBottom
484496
? html`
@@ -577,7 +589,7 @@ export function renderChat(props: ChatProps) {
577589
})}
578590
</div>`
579591
: nothing}
580-
${renderChatTaskSuggestionTray(props)}
592+
${gutterStack}
581593
${renderChatPullRequests({
582594
pullRequests: props.pullRequests ?? [],
583595
branch: props.pullRequestsBranch,
@@ -605,13 +617,6 @@ export function renderChat(props: ChatProps) {
605617
sessions: props.swarmSessions ?? [],
606618
sessionKey: props.sessionKey,
607619
})}
608-
${props.progressCard?.placement === "dock"
609-
? renderSessionProgressCard(
610-
props.progressCard.card,
611-
"dock",
612-
props.onDismissProgressCard,
613-
)
614-
: nothing}
615620
${showModelSetupSplash ? nothing : chatColumnFooter}
616621
</div>
617622
</div>

‎ui/src/styles/chat/layout.css‎

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ openclaw-chat-page {
1818
both, so the two never overlap and their bottoms stay on one line. */
1919
--chat-composer-side-inset: 36px;
2020
--chat-composer-bottom-gap: 14px;
21+
/* Docked progress-card width. Kept in step with PROGRESS_CARD_DOCK_MIN_GUTTER_PX
22+
in chat-pane-rails.ts, which gates the placement on a gutter wide enough for
23+
this card plus the gutter stack's insets. */
24+
--chat-progress-dock-width: 250px;
2125
--chat-thread-side-inset: clamp(6px, 1vw, 12px);
2226

2327
position: relative;
@@ -1697,21 +1701,41 @@ button.chat-reply-preview--message:disabled {
16971701
margin: 8px auto var(--chat-composer-bottom-gap, 14px);
16981702
}
16991703

1700-
/* Floating tray pinned to the conversation's top-right (the positioned
1701-
ancestor is .chat-main__conversation); content scrolls underneath it. */
1704+
/* The conversation's top-right gutter, owned by one column so its members
1705+
stack instead of overlapping (the positioned ancestor is
1706+
.chat-main__conversation); content scrolls underneath it. The column is as
1707+
wide as its widest member — the suggestion tray, which deliberately overhangs
1708+
the transcript — and narrower members right-align inside it. */
1709+
.chat-gutter-stack {
1710+
position: absolute;
1711+
z-index: 24;
1712+
top: 10px;
1713+
right: 14px;
1714+
display: grid;
1715+
width: min(450px, calc(100% - 28px));
1716+
justify-items: end;
1717+
gap: var(--space-3);
1718+
/* The column spans the tray's width even when only a narrow member renders,
1719+
so it must not swallow clicks aimed at the transcript beneath it. */
1720+
pointer-events: none;
1721+
}
1722+
1723+
.chat-gutter-stack > * {
1724+
pointer-events: auto;
1725+
}
1726+
17021727
.task-suggestions {
17031728
--task-suggestion-card-bg: color-mix(in srgb, var(--panel-strong) 72%, var(--panel-hover) 28%);
17041729
--task-suggestion-path-bg: color-mix(in srgb, var(--panel-hover) 84%, var(--text) 16%);
17051730
--task-suggestion-prompt-bg: var(--panel);
17061731
--task-suggestion-action-bg: color-mix(in srgb, var(--accent) 82%, var(--panel) 18%);
17071732
--task-suggestion-action-fg: var(--primary-foreground);
17081733

1709-
position: absolute;
1710-
z-index: 24;
1711-
top: 10px;
1712-
right: 14px;
1734+
/* Relative, not static: the --stack variant's offset shadow is positioned
1735+
against this box. Geometry otherwise comes from .chat-gutter-stack. */
1736+
position: relative;
17131737
display: grid;
1714-
width: min(450px, calc(100% - 28px));
1738+
width: 100%;
17151739
overflow: visible;
17161740
overscroll-behavior: contain;
17171741
}

‎ui/src/styles/chat/progress-card.css‎

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -400,25 +400,16 @@
400400
animation: fade-in 0.2s var(--ease-out);
401401
}
402402

403-
/* Docked in the conversation's right gutter, beside the centered composer.
404-
The inline-start edge repeats the composer's own half-width formula
405-
(.agent-chat__composer-shell, capped at the transcript width) so the two
406-
never overlap at any transcript-width setting; the pane only renders this
407-
placement once the measured gutter can hold the card. */
403+
/* Docked in the conversation's right gutter, below any suggestion tray sharing
404+
.chat-gutter-stack. The width is fixed rather than derived from the gutter:
405+
the pane only renders this placement once it has measured a gutter wide
406+
enough for this card plus the stack's insets, so the clearance is already
407+
guaranteed and a stable card beats one that grows with the window.
408+
Top-anchored by the stack, so appended steps extend downward instead of
409+
shifting the rows already being read. */
408410
.session-progress-card--dock {
409-
position: absolute;
410-
z-index: 3;
411-
inset-block-end: var(--chat-composer-bottom-gap, 14px);
412-
inset-inline-end: var(--chat-thread-gutter);
413-
inset-inline-start: calc(
414-
50% +
415-
min(
416-
50% - var(--chat-composer-side-inset, 36px) / 2,
417-
var(--chat-thread-max-width, 48rem) / 2
418-
) +
419-
var(--space-3)
420-
);
421-
max-height: min(46%, 420px);
411+
width: var(--chat-progress-dock-width);
412+
max-height: min(50vh, 420px);
422413
overflow-y: auto;
423414
padding: 10px 12px;
424415
border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));

0 commit comments

Comments
 (0)