Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): make wide markdown tables readable (#6840)

Louis Beaumontc6721aae2cae
diff --git a/.github/pr-assets/chat-wide-tables/after-scrolled.png b/.github/pr-assets/chat-wide-tables/after-scrolled.png
new file mode 100644
index 000000000..9cddb6e9b
Binary files /dev/null and b/.github/pr-assets/chat-wide-tables/after-scrolled.png differ
diff --git a/.github/pr-assets/chat-wide-tables/after.png b/.github/pr-assets/chat-wide-tables/after.png
new file mode 100644
index 000000000..a400f12ca
Binary files /dev/null and b/.github/pr-assets/chat-wide-tables/after.png differ
diff --git a/.github/pr-assets/chat-wide-tables/before.png b/.github/pr-assets/chat-wide-tables/before.png
new file mode 100644
index 000000000..74dface25
Binary files /dev/null and b/.github/pr-assets/chat-wide-tables/before.png differ
diff --git a/apps/screenpipe-app-tauri/components/chat/markdown-block.test.tsx b/apps/screenpipe-app-tauri/components/chat/markdown-block.test.tsx
index a094bdb64..6b5e3e39f 100644
--- a/apps/screenpipe-app-tauri/components/chat/markdown-block.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/markdown-block.test.tsx
@@ -85,6 +85,36 @@ describe("MarkdownBlock", () => {
);
});
+ it("keeps wide tables readable in a keyboard-scrollable container", () => {
+ render(
+ <MarkdownBlock
+ text={`| Company | Contact | Stage | Owner | Last touch | Next step | Risk |
+| --- | --- | --- | --- | --- | --- | --- |
+| Acme | Sam | Trial | Louis | Today | Follow up | Low |`}
+ isUser={false}
+ />,
+ );
+
+ const table = screen.getByRole("table");
+ const scrollRegion = screen.getByRole("region", {
+ name: "Scrollable table",
+ });
+
+ expect(scrollRegion).toContainElement(table);
+ expect(scrollRegion).toHaveAttribute("tabindex", "0");
+ expect(scrollRegion).toHaveClass(
+ "scrollbar-minimal",
+ "w-full",
+ "max-w-full",
+ "overflow-x-auto",
+ );
+ expect(table).toHaveClass(
+ "[&_td]:min-w-36",
+ "[&_th]:min-w-36",
+ "[&_tr>*:first-child]:sticky",
+ );
+ });
+
it.each([
["same-day", "2026-07-21T18:18:46.214586+00:00"],
["cross-day", "2026-07-20T23:58:04.120000+00:00"],
diff --git a/apps/screenpipe-app-tauri/components/chat/markdown-block.tsx b/apps/screenpipe-app-tauri/components/chat/markdown-block.tsx
index 97f3454ae..cf0b9ca3e 100644
--- a/apps/screenpipe-app-tauri/components/chat/markdown-block.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/markdown-block.tsx
@@ -150,6 +150,26 @@ export function MarkdownBlock({
p({ children }) {
return <p className="mb-2 last:mb-0 leading-relaxed">{children}</p>;
},
+ table({ children, node: _node, className: tableClassName, ...props }) {
+ return (
+ <div
+ className="scrollbar-minimal my-4 w-full max-w-full overflow-x-auto overscroll-x-contain rounded-md border border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
+ role="region"
+ aria-label="Scrollable table"
+ tabIndex={0}
+ >
+ <table
+ className={cn(
+ "!my-0 w-full border-collapse text-sm [&_td]:min-w-36 [&_td]:px-3 [&_th]:min-w-36 [&_th]:px-3 [&_thead]:bg-muted/50 [&_tr>*:first-child]:sticky [&_tr>*:first-child]:left-0 [&_tr>*:first-child]:z-10 [&_tr>*:first-child]:border-r [&_tr>*:first-child]:border-border [&_tr>*:first-child]:bg-background [&_thead_tr>*:first-child]:z-20 [&_thead_tr>*:first-child]:bg-muted",
+ tableClassName,
+ )}
+ {...props}
+ >
+ {children}
+ </table>
+ </div>
+ );
+ },
details({ children, ...props }) {
return (
<details