Skip to content

Commit bd65988

Browse files
t3dotggclaude
andauthored
revert: "fix(web): keep subagent links visible in long background-work banners" (pingdotgg#20054) (pingdotgg#22228)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 818f096 commit bd65988

3 files changed

Lines changed: 10 additions & 113 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,7 +5406,6 @@ export default function ChatView(props: ChatViewProps) {
54065406
/>
54075407
),
54085408
title: presentation.title,
5409-
descriptionPlacement: "below",
54105409
description:
54115410
presentation.items.length === 1 && presentation.items[0]?.childThreadId === undefined
54125411
? undefined
@@ -5422,7 +5421,7 @@ export default function ChatView(props: ChatViewProps) {
54225421
{separator}
54235422
</>
54245423
) : (
5425-
<span>
5424+
<span className="whitespace-nowrap">
54265425
<InlineButton
54275426
tone="muted"
54285427
aria-label={`${presentation.items.length === 1 ? "Show" : "Open"} subagent ${item.label}`}

‎apps/web/src/components/chat/ComposerBannerStack.browser.test.tsx‎

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { createRoot, type Root } from "react-dom/client";
55
import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
66
import { page, userEvent } from "vite-plus/test/browser";
77

8-
import { Button, InlineButton } from "../ui/button";
9-
108
import { ComposerBannerStack } from "./ComposerBannerStack";
119

1210
let root: Root;
@@ -62,94 +60,6 @@ it("only offers notice details when the description cannot fit", async () => {
6260
expect(hasDetails()).toBe(true);
6361
});
6462

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-
15363
it("keeps only the usage limit attached while an active goal waits in the collapsible stack", async () => {
15464
await act(async () =>
15565
root.render(

‎apps/web/src/components/chat/ComposerBannerStack.tsx‎

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export interface ComposerBannerStackItem {
1717
readonly icon: ReactNode;
1818
readonly title: ReactNode;
1919
readonly description?: ReactNode;
20-
readonly descriptionPlacement?: "inline" | "below";
2120
readonly children?: ReactNode;
2221
readonly actions?: ReactNode;
2322
readonly dismissLabel?: string;
@@ -348,46 +347,35 @@ function ComposerBannerStackAlert({
348347
</ComposerBanner.Root>
349348
);
350349
}
351-
const descriptionBelow = item.descriptionPlacement === "below";
352350
return (
353351
<ComposerBanner.Root
354352
role="alert"
355353
placement={attached ? "attached" : "floating"}
356354
variant={item.variant}
357355
density="comfortable"
358356
>
359-
<ComposerBanner.Row
360-
layout={descriptionBelow || item.priority === "activity" ? "inline" : "wrap-actions"}
361-
>
357+
<ComposerBanner.Row layout={item.priority === "activity" ? "inline" : "wrap-actions"}>
362358
<ComposerBanner.Icon className="h-(--composer-banner-icon-column) self-start">
363359
{item.icon}
364360
</ComposerBanner.Icon>
365-
<ComposerBanner.Content
366-
className={descriptionBelow ? "flex-col items-stretch gap-0" : "whitespace-nowrap"}
367-
>
361+
<ComposerBanner.Content className="whitespace-nowrap">
368362
<NoticeText
369363
detailsLabel="Show title details"
370364
className="min-w-0 truncate font-medium leading-7 sm:leading-6"
371365
>
372366
{item.title}
373367
</NoticeText>
374368
{item.description ? (
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-
)
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>
387375
) : null}
388376
</ComposerBanner.Content>
389377
{item.actions || item.onDismiss ? (
390-
<ComposerBanner.Actions className={descriptionBelow ? "self-start" : undefined}>
378+
<ComposerBanner.Actions>
391379
{item.actions}
392380
{item.onDismiss ? (
393381
<ComposerBanner.Dismiss

0 commit comments

Comments
 (0)