fix(chat): shrink markdown table wrappers to column widths (#3377)

This commit is contained in:
ChangeHow
2026-09-07 20:26:43 +03:00
committed by GitHub
parent 0459c8418b
commit 928bb3eae0
2 changed files with 4 additions and 1 deletions
@@ -383,6 +383,9 @@ describe('MarkdownRenderer DOM mount performance contract', () => {
expect(table?.classList.contains('min-w-full')).toBe(false);
expect(table?.classList.contains('w-full')).toBe(false);
expect(table?.parentElement?.classList.contains('overflow-x-auto')).toBe(true);
const wrapper = table?.closest('[data-markdown="table-wrapper"]');
expect(wrapper?.classList.contains('w-fit')).toBe(true);
expect(wrapper?.classList.contains('max-w-full')).toBe(true);
expect(cells.length).toBeGreaterThan(0);
expect(cells.every((cell) => cell.classList.contains('min-w-[120px]'))).toBe(true);
expect(cells.every((cell) => cell.classList.contains('max-w-[320px]'))).toBe(true);
@@ -344,7 +344,7 @@ const decorateTables = (root: HTMLElement, labels: DecorateLabels): void => {
if (existing) continue;
const wrapper = document.createElement('div');
wrapper.className = 'group my-4 flex flex-col space-y-2';
wrapper.className = 'group my-4 flex w-fit max-w-full flex-col space-y-2';
wrapper.setAttribute('data-markdown', 'table-wrapper');
const toolbar = document.createElement('div');