Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(flows): stop wide tables from horizontally scrolling the message list

Sergey Kozyrenko0068b53bb93f
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 | [email protected] | 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(<Markdown>{tableMarkdown}</Markdown>);
+
+ 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(<Markdown searchValue="sample">{tableMarkdown}</Markdown>);
+
+ 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 }) => (
+ <div className="overflow-x-auto">
+ <table {...props}>{processedSearch ? processTextNode(nodeChildren) : nodeChildren}</table>
+ </div>
+ );
+
return components;
- }, [processedSearch, createComponentRenderer]);
+ }, [processedSearch, createComponentRenderer, processTextNode]);
return (
<div className={`prose prose-sm dark:prose-invert max-w-none ${className || ''}`}>