@devries-cameron20 / t3code-1 / commits / cec1bb9de3
Fork 0

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

fix(web): align multiline error alert controls (#5304)

t3-code[bot] committed Aug 4, 2026 at 13:34 UTC cec1bb9de38a80d7c06faa6841360002ca136080
3 files changed +54 -5
apps/web/src/components/chat/ThreadErrorBanner.test.tsx new
+23
@@ -0,0 +1,23 @@
1 +import { renderToStaticMarkup } from "react-dom/server";
2 +import { describe, expect, it } from "vite-plus/test";
3 +
4 +import { ThreadErrorBanner } from "./ThreadErrorBanner";
5 +
6 +describe("ThreadErrorBanner", () => {
7 + it("aligns the warning and dismiss icons with the first line of a multi-line error", () => {
8 + const markup = renderToStaticMarkup(
9 + <ThreadErrorBanner
10 + error={"The first error line\ncontinues on a second line"}
11 + onDismiss={() => {}}
12 + />,
13 + );
14 +
15 + expect(markup).toContain('role="alert"');
16 + expect(markup).toContain('aria-label="Dismiss error"');
17 + expect(markup).not.toContain("controlAlignment");
18 + expect(markup).toContain("flex gap-2 items-start");
19 + expect(markup).toContain("min-h-7 pt-1 sm:min-h-6 sm:pt-0.5");
20 + expect(markup).toContain("h-lh w-4");
21 + expect(markup).toContain("h-lh self-start");
22 + });
23 +});
apps/web/src/components/chat/ThreadErrorBanner.tsx
+1 -1
@@ -14,7 +14,7 @@ export const ThreadErrorBanner = memo(function ThreadErrorBanner({
14 if (!error) return null;
15 return (
16 <div className="mx-auto w-fit max-w-[min(48rem,calc(100%-2rem))] pt-3">
17 - <Alert variant="error">
17 + <Alert variant="error" controlAlignment="first-line">
18 <CircleAlertIcon />
19 <AlertDescription>
20 <Tooltip>
apps/web/src/components/ui/alert.tsx
+30 -4
@@ -42,9 +42,13 @@ function alertChildSlot(child: React.ReactElement): string | undefined {
42 function Alert({
43 className,
44 variant,
45 + controlAlignment = "center",
46 children,
47 ...props
47 -}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
48 +}: React.ComponentProps<"div"> &
49 + VariantProps<typeof alertVariants> & {
50 + controlAlignment?: "center" | "first-line";
51 + }) {
52 const icon: React.ReactNode[] = [];
53 const content: React.ReactNode[] = [];
54 const action: React.ReactNode[] = [];
@@ -71,9 +75,24 @@ function Alert({
75 role="alert"
76 {...props}
77 >
74 - <div className="flex items-center gap-2">
78 + <div
79 + className={cn(
80 + "flex gap-2",
81 + controlAlignment === "first-line" ? "items-start" : "items-center",
82 + controlAlignment === "first-line" &&
83 + action.length > 0 &&
84 + "min-h-7 pt-1 sm:min-h-6 sm:pt-0.5",
85 + )}
86 + >
87 {icon.length > 0 && (
76 - <div className="flex size-4 shrink-0 items-center justify-center [&>svg]:size-full">
88 + <div
89 + className={cn(
90 + "flex shrink-0 items-center justify-center",
91 + controlAlignment === "first-line"
92 + ? "h-lh w-4 [&>svg]:size-4"
93 + : "size-4 [&>svg]:size-full",
94 + )}
95 + >
96 {icon}
97 </div>
98 )}
@@ -81,7 +100,14 @@ function Alert({
100 <div className="flex min-w-0 flex-1 flex-col gap-0.5">{content}</div>
101 )}
102 {action.length > 0 && (
84 - <div className="flex shrink-0 items-center self-center">{action}</div>
103 + <div
104 + className={cn(
105 + "flex shrink-0 items-center",
106 + controlAlignment === "first-line" ? "h-lh self-start" : "self-center",
107 + )}
108 + >
109 + {action}
110 + </div>
111 )}
112 </div>
113 </div>