From 99a7ec256f60d80e441b87ab3faa19f12b9a52a4 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Tue, 22 Sep 2026 15:53:24 +0800 Subject: [PATCH] fix(webui): wrap markdown table content --- webui/src/components/MarkdownTextRenderer.tsx | 6 ++++-- webui/src/globals.css | 7 +++---- webui/src/tests/markdown-text-renderer.test.tsx | 11 ++++++++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/webui/src/components/MarkdownTextRenderer.tsx b/webui/src/components/MarkdownTextRenderer.tsx index 9c5019d43..5f8849a09 100644 --- a/webui/src/components/MarkdownTextRenderer.tsx +++ b/webui/src/components/MarkdownTextRenderer.tsx @@ -714,11 +714,13 @@ export default function MarkdownTextRenderer({ > by the markdown renderer's - custom `table` component (see MarkdownTextRenderer); min-w-max on the -
keeps natural column widths so it scrolls instead of shrinking. */ + /* Markdown tables wrap cell text to fit the conversation column. The + renderer's overflow-x:auto wrapper remains a fallback for content that + cannot shrink. */ /* Clip any residual horizontal bleed at the thread column edge. Vertical scrolling and internal code-block scroll are unaffected. */ diff --git a/webui/src/tests/markdown-text-renderer.test.tsx b/webui/src/tests/markdown-text-renderer.test.tsx index 142f4921c..a17cd9c61 100644 --- a/webui/src/tests/markdown-text-renderer.test.tsx +++ b/webui/src/tests/markdown-text-renderer.test.tsx @@ -483,7 +483,16 @@ describe("MarkdownTextRenderer", () => { expect(surface).toHaveAttribute("role", "region"); expect(surface).toHaveAttribute("tabindex", "0"); expect(surface).toHaveAccessibleName("Data table"); - expect(screen.getByRole("table")).toHaveTextContent("nanobot"); + const table = screen.getByRole("table"); + expect(table).toHaveTextContent("nanobot"); + expect(table).not.toHaveClass("min-w-max"); + expect(table).toHaveClass( + "table-fixed", + "[&_th]:whitespace-normal", + "[&_th]:[overflow-wrap:anywhere]", + "[&_td]:whitespace-normal", + "[&_td]:[overflow-wrap:anywhere]", + ); expect(container.firstElementChild).toHaveClass("space-y-4"); expect(container.firstElementChild).not.toHaveClass("space-y-0"); });