diff --git a/frontend/src/components/shared/markdown.test.tsx b/frontend/src/components/shared/markdown.test.tsx
new file mode 100644
index 00000000..e48701a9
--- /dev/null
+++ b/frontend/src/components/shared/markdown.test.tsx
@@ -0,0 +1,27 @@
+import { render } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import Markdown from './markdown';
+
+const tableMarkdown = [
+ '| Name | Email | Token |',
+ '| --- | --- | --- |',
+ '| sample | sample@example.com | TOKEN{0000000000000000000000000000000000000000000000000000000000000000} |',
+].join('\n');
+
+describe('Markdown', () => {
+ it('wraps a table in a horizontally scrollable container so wide content cannot widen the message list', () => {
+ const { container } = render({tableMarkdown});
+
+ const table = container.querySelector('table');
+ expect(table).not.toBeNull();
+ expect(table?.parentElement?.className).toContain('overflow-x-auto');
+ });
+
+ it('keeps the table wrapped when search highlighting is active', () => {
+ const { container } = render({tableMarkdown});
+
+ const table = container.querySelector('table');
+ expect(table?.parentElement?.className).toContain('overflow-x-auto');
+ });
+});
diff --git a/frontend/src/components/shared/markdown.tsx b/frontend/src/components/shared/markdown.tsx
index 83d5df40..ec793079 100644
--- a/frontend/src/components/shared/markdown.tsx
+++ b/frontend/src/components/shared/markdown.tsx
@@ -229,8 +229,14 @@ function Markdown({ children, className, searchValue }: MarkdownProps) {
};
}
+ components.table = ({ children: nodeChildren, ...props }) => (
+
+
{processedSearch ? processTextNode(nodeChildren) : nodeChildren}
+
+ );
+
return components;
- }, [processedSearch, createComponentRenderer]);
+ }, [processedSearch, createComponentRenderer, processTextNode]);
return (