Skip to content

Commit 88ab83e

Browse files
t3dotggclaude
andauthored
fix(web): reconnecting notice no longer shifts the new thread composer (#26958)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 6d450a4 commit 88ab83e

4 files changed

Lines changed: 50 additions & 19 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ import { useThreadLinkedPullRequest } from "./pullRequest/useThreadLinkedPullReq
306306
import { useProactivePanels } from "../hooks/useProactivePanels";
307307
import { useIncrementalTimelineEntries } from "../hooks/useIncrementalTimelineEntries";
308308
import { useRightPanelSurfaceClose } from "../hooks/useRightPanelSurfaceClose";
309-
import type { ComposerBannerStackItem } from "./chat/ComposerBannerStack";
309+
import { ComposerBannerStack, type ComposerBannerStackItem } from "./chat/ComposerBannerStack";
310310
import { modelFallbackBannerItem } from "./chat/ComposerUsageLimits";
311311
import { ComposerSurface } from "./chat/ComposerSurface";
312312
import { resolveThreadSyncPhase } from "../threadSync";
@@ -3516,7 +3516,7 @@ export default function ChatView(props: ChatViewProps) {
35163516
: projectCloneSendBlockReason
35173517
}
35183518
isPreparingWorktree={isPreparingWorktree && !sendQueuesBehindSetup}
3519-
bannerItems={composerBannerItems}
3519+
bannerItems={isDraftHeroState ? [] : composerBannerItems}
35203520
resumeCompactionTokens={resumeCompactionTokens}
35213521
keepFullHistory={keepFullHistory}
35223522
onToggleKeepFullHistory={toggleKeepFullHistoryStable}
@@ -3682,6 +3682,12 @@ export default function ChatView(props: ChatViewProps) {
36823682
)}
36833683
</div>
36843684
</div>
3685+
{isDraftHeroState && composerBannerItems.length > 0 ? (
3686+
// Out of flow, like the headline, so a notice never moves the centered composer.
3687+
<div className="absolute inset-x-0 top-full flex flex-col gap-1 pt-4">
3688+
<ComposerBannerStack items={composerBannerItems} detached />
3689+
</div>
3690+
) : null}
36853691
</ComposerSurface.Shell>
36863692
<div
36873693
aria-hidden

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,36 @@ const variantColors: Record<ComposerBannerVariant, string> = {
3333
"[--chat-composer-attached-outline:color-mix(in_srgb,var(--warning)_28%,transparent)] [--chat-composer-attached-tint:color-mix(in_srgb,var(--warning)_8%,transparent)]",
3434
};
3535

36+
/**
37+
* An attached surface tucks its bottom under the card below it. A detached one is a whole card
38+
* of its own, for a notice that sits apart from the composer.
39+
*/
3640
function Surface({
3741
variant = "default",
42+
detached = false,
3843
className,
3944
...props
4045
}: ComponentProps<"div"> & {
4146
variant?: ComposerBannerVariant;
47+
detached?: boolean;
4248
}) {
4349
return (
4450
<div
45-
data-composer-banner-surface="attached"
51+
data-composer-banner-surface={detached ? "detached" : "attached"}
4652
data-variant={variant}
4753
className={cn(
4854
surfaceColors,
4955
"relative isolate border-0 bg-transparent shadow-none [--chat-composer-attached-tint:transparent]",
5056
variantColors[variant],
51-
// Bleed the mask 1px past the seam to cover Chromium's fractional-pixel backdrop loss.
52-
"[--chat-composer-attachment-overlap:calc(1rem+1px)] before:rounded-t-2xl before:mask-t-from-transparent before:mask-t-from-4 before:mask-t-to-black before:mask-t-to-4",
57+
detached
58+
? "[--chat-composer-attachment-overlap:0px] before:rounded-2xl"
59+
: // Bleed the mask 1px past the seam to cover Chromium's fractional-pixel backdrop loss.
60+
"[--chat-composer-attachment-overlap:calc(1rem+1px)] before:rounded-t-2xl before:mask-t-from-transparent before:mask-t-from-4 before:mask-t-to-black before:mask-t-to-4",
5361
"before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:border before:border-(--chat-composer-attached-outline)",
5462
"before:bg-(--chat-composer-attached-surface)/(--glass-opacity) before:bg-linear-to-b before:from-(--chat-composer-attached-tint) before:to-(--chat-composer-attached-tint) before:backdrop-blur-(--glass-blur) before:backdrop-saturate-(--glass-saturation)",
5563
"before:shadow-composer dark:before:shadow-composer-dark",
56-
"dark:supports-[(backdrop-filter:blur(1px))_or_(-webkit-backdrop-filter:blur(1px))]:before:bg-composer-seam-above",
64+
!detached &&
65+
"dark:supports-[(backdrop-filter:blur(1px))_or_(-webkit-backdrop-filter:blur(1px))]:before:bg-composer-seam-above",
5766
"not-supports-[((backdrop-filter:blur(1px))_or_(-webkit-backdrop-filter:blur(1px)))]:before:bg-(--chat-composer-attached-surface)",
5867
className,
5968
)}
@@ -108,9 +117,8 @@ function Root({
108117
variant = "default",
109118
width = "fill",
110119
...props
111-
}: ComponentProps<"div"> & {
120+
}: ComponentProps<typeof Surface> & {
112121
density?: "default" | "comfortable" | "spacious";
113-
variant?: ComposerBannerVariant;
114122
width?: "fill" | "content";
115123
}) {
116124
return (

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

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ComposerBanner, type ComposerBannerVariant } from "./ComposerBanner";
77
import { observeResize } from "~/lib/observeResize";
88

99
/**
10-
* Where a notice sits above the composer. The machine comes first, then what needs you; the
10+
* Where a notice sits in the stack. The machine comes first, then what needs you; the
1111
* order is fixed so rows never trade places as notices come and go.
1212
*/
1313
export type ComposerBannerGroup = "environment" | "attention";
@@ -27,23 +27,33 @@ export interface ComposerBannerStackItem {
2727

2828
const GROUPS = ["environment", "attention"] as const;
2929

30+
const FADE_IN =
31+
"transition-opacity duration-150 ease-out starting:opacity-0 motion-reduce:transition-none";
32+
3033
/**
3134
* Notices about sending from this composer, each its own attached card. Consecutive cards join
32-
* edge to edge, and the last joins the composer or the drawer below it.
35+
* edge to edge, and the last joins the composer or the drawer below it. Detached cards stand
36+
* apart instead, for layouts where the composer must not move when a notice appears.
3337
*/
3438
export function ComposerBannerStack({
3539
items,
40+
detached = false,
3641
}: {
3742
readonly items: ReadonlyArray<ComposerBannerStackItem>;
43+
readonly detached?: boolean;
3844
}) {
39-
return GROUPS.flatMap((group) =>
45+
const ordered = GROUPS.flatMap((group) =>
4046
items.filter((item) => (item.group ?? "attention") === group),
41-
).map((item) => (
42-
<ComposerBanner.Attachment
43-
key={item.id}
44-
data-composer-banner-stack="true"
45-
className="transition-opacity duration-150 ease-out starting:opacity-0 motion-reduce:transition-none"
46-
>
47+
);
48+
if (detached) {
49+
return ordered.map((item) => (
50+
<div key={item.id} data-composer-banner-stack="true" className={FADE_IN}>
51+
<NoticeCard item={item} detached />
52+
</div>
53+
));
54+
}
55+
return ordered.map((item) => (
56+
<ComposerBanner.Attachment key={item.id} data-composer-banner-stack="true" className={FADE_IN}>
4757
<NoticeCard item={item} />
4858
</ComposerBanner.Attachment>
4959
));
@@ -125,11 +135,18 @@ export function NoticeText({
125135
);
126136
}
127137

128-
function NoticeCard({ item }: { readonly item: ComposerBannerStackItem }) {
138+
function NoticeCard({
139+
item,
140+
detached = false,
141+
}: {
142+
readonly item: ComposerBannerStackItem;
143+
readonly detached?: boolean;
144+
}) {
129145
return (
130146
<ComposerBanner.Root
131147
role={item.variant === "error" || item.variant === "warning" ? "alert" : undefined}
132148
variant={item.variant}
149+
detached={detached}
133150
density="comfortable"
134151
data-chat-composer-collapsed-controls="true"
135152
>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Host({ className, ...props }: ComponentProps<"div">) {
4141
"relative z-10 w-full rounded-2xl shadow-composer after:z-1 dark:shadow-none",
4242
"group-data-context-row/composer-surface:before:pointer-events-none group-data-context-row/composer-surface:before:absolute group-data-context-row/composer-surface:before:inset-0 group-data-context-row/composer-surface:before:-z-1 group-data-context-row/composer-surface:before:rounded-2xl group-data-context-row/composer-surface:before:bg-(--chat-composer-glass-surface)/(--glass-opacity) group-data-context-row/composer-surface:before:backdrop-blur-(--glass-blur) group-data-context-row/composer-surface:before:backdrop-saturate-(--glass-saturation)",
4343
outlineClasses,
44-
"group-has-data-[composer-banner-surface=attached]/composer-surface:shadow-none group-has-data-[composer-banner-surface=attached]/composer-surface:after:hidden",
44+
"group-has-data-[composer-banner-surface=attached]/composer-surface:shadow-none group-has-data-[composer-banner-surface=attached]/composer-surface:before:hidden group-has-data-[composer-banner-surface=attached]/composer-surface:after:hidden",
4545
className,
4646
)}
4747
{...props}

0 commit comments

Comments
 (0)