@devries-cameron20 / t3code-1 / commits / 3a69f7ada4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): keep subagent links visible in long background-work banners (#20054)

Co-authored-by: Andrey Velts <a.velts@vk.team> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Andrey Velts committed Oct 20, 2026 at 08:09 UTC 3a69f7ada4cb012b8f4da580efdae72e5717bcda
3 files changed +113 -10
apps/web/src/components/ChatView.tsx
+2 -1
@@ -5273,6 +5273,7 @@ export default function ChatView(props: ChatViewProps) {
5273 />
5274 ),
5275 title: presentation.title,
5276 + descriptionPlacement: "below",
5277 description:
5278 presentation.items.length === 1 && presentation.items[0]?.childThreadId === undefined
5279 ? undefined
@@ -5288,7 +5289,7 @@ export default function ChatView(props: ChatViewProps) {
5289 {separator}
5290 </>
5291 ) : (
5291 - <span className="whitespace-nowrap">
5292 + <span>
5293 <InlineButton
5294 tone="muted"
5295 aria-label={`${presentation.items.length === 1 ? "Show" : "Open"} subagent ${item.label}`}
apps/web/src/components/chat/ComposerBannerStack.browser.test.tsx
+90
@@ -5,6 +5,8 @@ import { createRoot, type Root } from "react-dom/client";
5 import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
6 import { page, userEvent } from "vite-plus/test/browser";
7
8 +import { Button, InlineButton } from "../ui/button";
9 +
10 import { ComposerBannerStack } from "./ComposerBannerStack";
11
12 let root: Root;
@@ -60,6 +62,94 @@ it("only offers notice details when the description cannot fit", async () => {
62 expect(hasDetails()).toBe(true);
63 });
64
65 +it.each([320, 800])(
66 + "keeps long background-work links reachable beside Stop in a %ipx composer",
67 + async (width) => {
68 + await page.viewport(width + 32, 800);
69 + container.style.width = `${width}px`;
70 + const openThread = vi.fn();
71 + const label = "Review the background task layout and child-thread navigation ".repeat(6);
72 + await act(async () =>
73 + root.render(
74 + <ComposerBannerStack
75 + items={[
76 + {
77 + id: "background-work",
78 + variant: "default",
79 + priority: "activity",
80 + icon: null,
81 + title: "12 background tasks",
82 + descriptionPlacement: "below",
83 + description: Array.from({ length: 12 }, (_, index) => (
84 + <span key={index}>
85 + {index > 0 ? " " : null}
86 + <InlineButton
87 + tone="muted"
88 + aria-label={`Open subagent ${index + 1}`}
89 + onClick={() => openThread(index + 1)}
90 + >
91 + {label}
92 + </InlineButton>
93 + {index < 11 ? "," : null}
94 + </span>
95 + )),
96 + actions: (
97 + <Button size="xs" variant="ghost">
98 + Stop
99 + </Button>
100 + ),
101 + },
102 + ]}
103 + />,
104 + ),
105 + );
106 + await nextFrame();
107 +
108 + const firstLink = page.getByRole("button", { name: "Open subagent 1", exact: true });
109 + const lastLink = page.getByRole("button", { name: "Open subagent 12", exact: true });
110 + const stop = page.getByRole("button", { name: "Stop", exact: true });
111 + expect(firstLink.element().getBoundingClientRect().height).toBeGreaterThan(
112 + Number.parseFloat(getComputedStyle(firstLink.element()).lineHeight) * 2,
113 + );
114 + const viewport = container.querySelector<HTMLElement>('[data-slot="scroll-area-viewport"]')!;
115 + expect(viewport).not.toBeNull();
116 + expect(viewport.clientHeight).toBeGreaterThan(0);
117 + expect(viewport.clientHeight).toBeLessThanOrEqual(window.innerHeight / 2);
118 + expect(viewport.scrollHeight).toBeGreaterThan(viewport.clientHeight);
119 + expect(viewport.scrollWidth).toBeLessThanOrEqual(viewport.clientWidth + 1);
120 +
121 + const scrollBounds = viewport.getBoundingClientRect();
122 + const stopBounds = stop.element().getBoundingClientRect();
123 + expect(stopBounds.top).toBe(
124 + page.getByText("12 background tasks", { exact: true }).element().getBoundingClientRect().top,
125 + );
126 + expect(scrollBounds.right).toBeLessThanOrEqual(stopBounds.left);
127 + expect(stopBounds.right).toBeLessThanOrEqual(container.getBoundingClientRect().right);
128 + expect(stopBounds.bottom).toBeLessThanOrEqual(scrollBounds.bottom);
129 + expect(lastLink.element().getBoundingClientRect().top).toBeGreaterThan(scrollBounds.bottom);
130 + await firstLink.click();
131 + expect(openThread).toHaveBeenLastCalledWith(1);
132 +
133 + viewport.scrollTop = viewport.scrollHeight;
134 + await nextFrame();
135 + expect(viewport.scrollTop).toBeGreaterThan(0);
136 + const lastBounds = lastLink.element().getBoundingClientRect();
137 + expect(lastBounds.top).toBeGreaterThanOrEqual(scrollBounds.top);
138 + expect(lastBounds.bottom).toBeLessThanOrEqual(scrollBounds.bottom + 1);
139 + expect(stop.element().getBoundingClientRect().top).toBe(stopBounds.top);
140 + for (const control of [lastLink.element(), stop.element()]) {
141 + const bounds = control.getBoundingClientRect();
142 + expect(
143 + control.contains(
144 + document.elementFromPoint(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2),
145 + ),
146 + ).toBe(true);
147 + }
148 + await lastLink.click();
149 + expect(openThread).toHaveBeenLastCalledWith(12);
150 + },
151 +);
152 +
153 it("keeps only the usage limit attached while an active goal waits in the collapsible stack", async () => {
154 await act(async () =>
155 root.render(
apps/web/src/components/chat/ComposerBannerStack.tsx
+21 -9
@@ -17,6 +17,7 @@ export interface ComposerBannerStackItem {
17 readonly icon: ReactNode;
18 readonly title: ReactNode;
19 readonly description?: ReactNode;
20 + readonly descriptionPlacement?: "inline" | "below";
21 readonly children?: ReactNode;
22 readonly actions?: ReactNode;
23 readonly dismissLabel?: string;
@@ -347,6 +348,7 @@ function ComposerBannerStackAlert({
348 </ComposerBanner.Root>
349 );
350 }
351 + const descriptionBelow = item.descriptionPlacement === "below";
352 return (
353 <ComposerBanner.Root
354 role="alert"
@@ -354,11 +356,15 @@ function ComposerBannerStackAlert({
356 variant={item.variant}
357 density="comfortable"
358 >
357 - <ComposerBanner.Row layout={item.priority === "activity" ? "inline" : "wrap-actions"}>
359 + <ComposerBanner.Row
360 + layout={descriptionBelow || item.priority === "activity" ? "inline" : "wrap-actions"}
361 + >
362 <ComposerBanner.Icon className="h-(--composer-banner-icon-column) self-start">
363 {item.icon}
364 </ComposerBanner.Icon>
361 - <ComposerBanner.Content className="whitespace-nowrap">
365 + <ComposerBanner.Content
366 + className={descriptionBelow ? "flex-col items-stretch gap-0" : "whitespace-nowrap"}
367 + >
368 <NoticeText
369 detailsLabel="Show title details"
370 className="min-w-0 truncate font-medium leading-7 sm:leading-6"
@@ -366,16 +372,22 @@ function ComposerBannerStackAlert({
372 {item.title}
373 </NoticeText>
374 {item.description ? (
369 - <NoticeText
370 - detailsLabel="Show notice details"
371 - className="w-0 min-w-0 grow truncate text-muted-foreground @max-[400px]:sr-only"
372 - >
373 - {item.description}
374 - </NoticeText>
375 + descriptionBelow ? (
376 + <ComposerBanner.Scroll className="text-muted-foreground whitespace-normal wrap-anywhere [--inline-button-text-align:start] [--inline-button-white-space:normal] [&_[data-slot=inline-button]]:max-w-full">
377 + <span className="block pb-1">{item.description}</span>
378 + </ComposerBanner.Scroll>
379 + ) : (
380 + <NoticeText
381 + detailsLabel="Show notice details"
382 + className="w-0 min-w-0 grow truncate text-muted-foreground @max-[400px]:sr-only"
383 + >
384 + {item.description}
385 + </NoticeText>
386 + )
387 ) : null}
388 </ComposerBanner.Content>
389 {item.actions || item.onDismiss ? (
378 - <ComposerBanner.Actions>
390 + <ComposerBanner.Actions className={descriptionBelow ? "self-start" : undefined}>
391 {item.actions}
392 {item.onDismiss ? (
393 <ComposerBanner.Dismiss