web: contain markdown tables inside the phone transcript

Wrap each table in its own scroll frame and let the markdown grid shrink, so a
wide table scrolls sideways instead of pushing the chat content past its div.
This commit is contained in:
2026-10-20 11:50:27 +01:00
parent 443986498d
commit 74b74adee7
2 changed files with 14 additions and 5 deletions
+10 -4
View File
@@ -778,8 +778,8 @@
.chat-stop { border-color: var(--bad); color: var(--bad); }
/* The rendered markdown subset. Every node is created, never parsed from HTML. */
.markdown { display: grid; gap: 8px; min-width: 0; }
.markdown > * { margin: 0; }
.markdown { display: grid; gap: 8px; min-width: 0; max-width: 100%; }
.markdown > * { margin: 0; min-width: 0; }
.md-heading { font-size: 15px; }
.md-paragraph { line-height: 1.55; overflow-wrap: anywhere; }
.md-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
@@ -797,8 +797,14 @@
.md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.md-quote { display: grid; gap: 6px; padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
.md-list { display: grid; gap: 4px; margin: 0; padding-left: 20px; }
.md-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.md-table-wrap {
max-width: 100%;
min-width: 0;
overflow-x: auto;
overscroll-behavior-x: contain;
}
.md-table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.md-table th { background: var(--surface-2); }
.md-rule { border: 0; border-top: 1px solid var(--border); }
.md-link { color: var(--accent); }
+4 -1
View File
@@ -3184,7 +3184,10 @@ function renderMarkdownBlock(block) {
body.append(tr);
}
table.append(body);
return table;
// A markdown table must never widen the message bubble. Scroll it sideways
// inside its own frame on a phone instead of pushing the transcript past its
// right edge.
return h("div", { class: "md-table-wrap" }, table);
}
// Anything outside the subset stays plain text and is never dropped.
return h("p", { class: "md-paragraph", text: block.text ?? "" });