The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 13:15 UTC
fix(web): chat tables open at the right size instead of collapsed and cut off (#26449)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 28, 2026 at 05:15 UTC
eb751fa0730d6a51d56547cb7fcaf4822a7e0e3b
6 files changed
+30
-79
apps/web/src/components/chat/MarkdownExternalLink.tsx
+12
-6
@@ -54,13 +54,19 @@ function leadingExternalLinkTextLength(text: string): number {
54
return Math.min(text.length, 1);
55
}
56
57
+// Long words such as URLs can break after any character so they fit narrow
58
+// table columns. Short ones, like a PR number, stay whole.
59
function breakableExternalLinkText(text: string): ReactNode[] {
58
- return Array.from(text, (character, index) => (
59
- <Fragment key={`${index}:${character}`}>
60
- {character}
61
- <wbr />
62
- </Fragment>
63
- ));
60
+ return Array.from(text.matchAll(/\s+|\S+/g), ({ 0: word, index: start }) =>
61
+ word.length <= 16
62
+ ? word
63
+ : Array.from(word, (character, offset) => (
64
+ <Fragment key={`${start + offset}:${character}`}>
65
+ {character}
66
+ <wbr />
67
+ </Fragment>
68
+ )),
69
+ );
70
}
71
72
export function MarkdownExternalLinkContent({
apps/web/src/components/chat/MarkdownTable.tsx
+4
-28
@@ -1,8 +1,7 @@
1
-import { Check, Copy, Maximize2, Minimize2 } from "lucide";
2
-import { useRef, useState, type ComponentProps } from "react";
1
+import { Check, Copy } from "lucide";
2
+import { useRef, type ComponentProps } from "react";
3
4
import { useCopyToClipboard } from "../../hooks/useCopyToClipboard";
5
-import { getClientSettings } from "../../hooks/useSettings";
5
import {
6
serializeTableElementToCsv,
7
serializeTableElementToMarkdown,
@@ -16,13 +15,11 @@ import { reportMarkdownActionFailure } from "./markdownActionFailure";
15
16
export function MarkdownTable({ children, ...props }: ComponentProps<"table">) {
17
const containerRef = useRef<HTMLDivElement | null>(null);
19
- const [expanded, setExpanded] = useState(() => getClientSettings().wordWrap);
18
const { copyToClipboard, isCopied: copied } = useCopyToClipboard<"markdown" | "csv">({
19
timeout: 1200,
20
onError: (cause, format) =>
21
reportMarkdownActionFailure({ operation: "copy-table", format }, cause),
22
});
25
- const expandLabel = expanded ? "Collapse table cells" : "Expand table cells";
23
const copyLabel = copied ? "Copied" : "Copy table";
24
25
const handleCopy = (format: "markdown" | "csv") => {
@@ -37,33 +34,12 @@ export function MarkdownTable({ children, ...props }: ComponentProps<"table">) {
34
};
35
36
return (
40
- <div
41
- ref={containerRef}
42
- className="chat-markdown-table-container"
43
- data-expanded={expanded ? "true" : "false"}
44
- >
37
+ <div ref={containerRef} className="chat-markdown-table-container">
38
<ScrollArea radius="none" chainVerticalScroll scrollFade className="w-full max-w-full">
39
<table {...props}>{children}</table>
40
</ScrollArea>
41
{/* Stays within the row's px-1: the chat lane clips sideways overflow. */}
49
- <div className="mt-0.5 -mx-1 flex items-center justify-between select-none">
50
- <Tooltip>
51
- <TooltipTrigger
52
- render={
53
- <Button
54
- type="button"
55
- variant={expanded ? "secondary" : "ghost-muted"}
56
- size="icon-xs"
57
- aria-pressed={expanded}
58
- onClick={() => setExpanded((value) => !value)}
59
- aria-label={expandLabel}
60
- />
61
- }
62
- >
63
- <MorphIcon className="size-3" icon={expanded ? Minimize2 : Maximize2} />
64
- </TooltipTrigger>
65
- <TooltipPopup side="top">{expandLabel}</TooltipPopup>
66
- </Tooltip>
42
+ <div className="mt-0.5 -mx-1 flex items-center justify-end select-none">
43
<Menu>
44
<Tooltip>
45
<TooltipTrigger
apps/web/src/components/chat/MessagesTimeline.tsx
+2
-5
@@ -1221,7 +1221,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
1221
>
1222
<div
1223
ref={observeLaneWidth}
1224
- className="@container/chat-lane chat-content-lane overflow-x-clip"
1224
+ className="chat-content-lane overflow-x-clip"
1225
data-timeline-root="true"
1226
>
1227
<AudioPreviewUnmountContext value={onAudioUnmount}>
@@ -1241,10 +1241,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
1241
{unmatchedPendingApprovals.size > 0 ? (
1242
<TimelineRowCtx value={sharedState}>
1243
<div className="messages-timeline-row-frame">
1244
- <div
1245
- className="@container/chat-lane chat-content-lane overflow-x-clip"
1246
- data-timeline-root="true"
1247
- >
1244
+ <div className="chat-content-lane overflow-x-clip" data-timeline-root="true">
1245
<WorkLogBlock>
1246
{[...unmatchedPendingApprovals.values()].map((approval) => (
1247
<TimelinePendingApprovalRow key={approval.requestId} approval={approval} />
apps/web/src/components/settings/TypographySettings.tsx
+2
-2
@@ -235,7 +235,7 @@ function WordWrapRow() {
235
return (
236
<SettingsRow
237
{...searchableSetting("word-wrap")}
238
- description="Wrap long lines in code blocks, tables, diffs, and file previews by default."
238
+ description="Wrap long lines in code blocks, diffs, and file previews by default."
239
resetAction={
240
settings.wordWrap !== DEFAULT_UNIFIED_SETTINGS.wordWrap ? (
241
<SettingResetButton
@@ -248,7 +248,7 @@ function WordWrapRow() {
248
<Switch
249
checked={settings.wordWrap}
250
onCheckedChange={(checked) => updateSettings({ wordWrap: Boolean(checked) })}
251
- aria-label="Wrap code, tables, diffs, and file previews by default"
251
+ aria-label="Wrap code, diffs, and file previews by default"
252
/>
253
}
254
/>
apps/web/src/components/settings/settingsSearch.ts
+1
-1
@@ -380,7 +380,7 @@ export const SETTINGS_SEARCH_ITEMS = [
380
id: "word-wrap",
381
title: "Word wrap",
382
to: "/settings/appearance",
383
- searchTerms: ["long lines code blocks tables diffs file previews"],
383
+ searchTerms: ["long lines code blocks diffs file previews"],
384
},
385
{
386
id: "composer-context",
apps/web/src/index.css
+9
-37
@@ -2193,14 +2193,13 @@ code {
2193
}
2194
}
2195
2196
-/* Diagnostics-style tables: row separators only, uppercase headers, and a
2197
- scroll-fade container for horizontal overflow. The root chat-markdown
2198
- wrapping rules (overflow-wrap: anywhere) would let columns shrink to single
2199
- characters and defeat the overflow — restore word-boundary wrapping so the
2200
- min column width is the longest word. */
2196
+/* Diagnostics-style tables: row separators only, and a scroll-fade container
2197
+ for horizontal overflow. Cells wrap and the table fits its lane. The root
2198
+ chat-markdown wrapping rules (overflow-wrap: anywhere) would let columns
2199
+ shrink to single characters, so restore word-boundary wrapping: the min
2200
+ column width is the longest word, and only wider content scrolls. */
2201
.chat-markdown table {
2202
width: 100%;
2203
- min-width: max-content;
2203
border-collapse: collapse;
2204
overflow-wrap: normal;
2205
word-break: normal;
@@ -2230,48 +2229,21 @@ code {
2229
border-bottom: 1px solid color-mix(in srgb, var(--contrast-border) 60%, transparent);
2230
padding-block: 0.55rem;
2231
font-weight: 600;
2233
- white-space: nowrap;
2232
}
2233
2234
.chat-markdown tbody td {
2235
border-bottom: 1px solid color-mix(in srgb, var(--contrast-border) 60%, transparent);
2236
}
2237
2240
-/* Collapsed (default): single-line cells truncate so arbitrary chat content
2241
- cannot blow the column out; the footer toggle expands cells to wrap. */
2242
-.chat-markdown .chat-markdown-table-container[data-expanded="false"] th,
2243
-.chat-markdown .chat-markdown-table-container[data-expanded="false"] td {
2244
- overflow: hidden;
2238
+/* Caps a long path, URL, or chip at 24rem; text past the cap wraps. */
2239
+.chat-markdown :is(th, td) {
2240
max-width: 24rem;
2246
- text-overflow: ellipsis;
2247
- white-space: nowrap;
2248
-}
2249
-
2250
-.chat-markdown .chat-markdown-table-container[data-expanded="true"] td {
2251
- max-width: 24rem;
2252
- overflow-wrap: anywhere;
2253
-}
2254
-
2255
-/* Fit expanded tables to wide timeline lanes; narrow lanes keep horizontal
2256
- scrolling so prose columns remain readable. */
2257
-@container chat-lane (min-width: 36rem) {
2258
- .chat-markdown .chat-markdown-table-container[data-expanded="true"] table {
2259
- min-width: 0;
2260
- }
2261
-
2262
- .chat-markdown .chat-markdown-table-container[data-expanded="true"] th {
2263
- white-space: normal;
2264
- }
2265
-
2266
- .chat-markdown .chat-markdown-table-container[data-expanded="true"] td {
2267
- overflow-wrap: break-word;
2268
- }
2241
+ overflow-wrap: break-word;
2242
}
2243
2244
/* Formula cells keep their natural width and scroll with the table. */
2272
-.chat-markdown .chat-markdown-table-container td:has([data-markdown-math]) {
2245
+.chat-markdown :is(th, td):has([data-markdown-math]) {
2246
max-width: none;
2274
- overflow: visible;
2247
}
2248
2249
:root {