Skip to content

Contain markdown tables in chat transcripts#14

Merged
Jay1 merged 1 commit into
mainfrom
jcode/fix-react-error-185
May 28, 2026
Merged

Contain markdown tables in chat transcripts#14
Jay1 merged 1 commit into
mainfrom
jcode/fix-react-error-185

Conversation

@Jay1
Copy link
Copy Markdown
Owner

@Jay1 Jay1 commented May 28, 2026

What Changed

  • Wrap rendered markdown tables in a horizontal scroll container.
  • Add transcript styling so wide tables stay contained within chat rows.
  • Add a browser regression test for completed assistant diff tables with long file paths.

Why

Wide markdown tables in assistant messages can overflow chat transcript rows, especially when diff summaries include long file paths. Wrapping tables in an overflow container keeps the message layout stable while preserving the full table content through horizontal scrolling.

UI Changes

  • Adds horizontal scrolling behavior for wide markdown tables in chat messages.
  • Screenshots not included; this is a contained CSS/renderer behavior change covered by a browser regression test.

Validation

  • bun run --cwd apps/web test:browser src/components/chat/ChatTranscriptPane.browser.tsx

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included validation details
  • UI impact is documented

Reviewer Notes

  • CodeRabbit reported a docstring coverage warning. The touched code is TypeScript React UI/test code and follows the repo's existing style, which does not add JSDoc/docstrings for local React renderers or browser tests unless they document public APIs. Adding docstrings here would be noise rather than a repo-consistent fix.

- Wrap rendered markdown tables in a horizontal scroll container
- Add regression coverage for completed diff tables
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR adds horizontal scrolling support for markdown tables rendered in chat transcripts. CSS styling enables the scroll container, a React table component applies the wrapper class to all markdown tables, and a new test verifies the feature works end-to-end.

Changes

Scrollable chat markdown tables

Layer / File(s) Summary
Scrollable table CSS styling
apps/web/src/index.css
Added .chat-markdown-table-scroll wrapper class with overflow-x: auto and min-width: 100% on contained tables. Extended the shared chat markdown spacing selector list to apply vertical margins to the wrapper.
React table component wrapper
apps/web/src/components/ChatMarkdown.tsx
Added custom table renderer in markdownComponents that wraps rendered <table> elements in div.chat-markdown-table-scroll.
Test and verification
apps/web/src/components/chat/ChatTranscriptPane.browser.tsx
Added DIFF_TABLE_MESSAGE markdown string with a sample diff table, and introduced a new test that renders ChatTranscriptPane with this message and verifies the scroll container and table elements are rendered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Tables grow wide in rabbit discourse,
So we wrap them gently in scroll-enabled sleeves,
A div, a class, a CSS course—
Now wide diffs flow without need to wheeze! 🌊

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers Summary and Testing sections but omits required sections including Why, Validation checklist, UI Changes, and Reviewer Notes from the template. Add the missing template sections: Why (explaining the problem/user impact), a completed Validation checklist with test/check details, UI Changes (screenshots or 'Not applicable'), and Reviewer Notes if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Contain markdown tables in chat transcripts' directly and specifically describes the main change: implementing horizontal scroll containment for markdown tables in chat UI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jcode/fix-react-error-185

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jay1 Jay1 self-assigned this May 28, 2026
@github-actions github-actions Bot added size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 28, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/index.css (1)

457-465: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix double margin on wrapped tables.

Both .chat-markdown-table-scroll (the wrapper) and .chat-markdown table (the inner table) are in the spacing selector list, so both receive margin: 0.65rem 0. Since tables are now wrapped in the scroll container, this creates unwanted internal spacing—the table will have its own margin inside the wrapper that also has margin.

Remove .chat-markdown table from the spacing selector and let the wrapper handle spacing, or add a reset rule.

🔧 Suggested fix

Option 1: Remove table from the spacing selector (preferred)

 .chat-markdown p,
 .chat-markdown ul,
 .chat-markdown ol,
 .chat-markdown blockquote,
 .chat-markdown pre,
-.chat-markdown-table-scroll,
-.chat-markdown table {
+.chat-markdown-table-scroll {
   margin: 0.65rem 0;
 }

Option 2: Add a reset rule after the wrapper styles

 .chat-markdown-table-scroll > table {
   min-width: 100%;
 }
+
+.chat-markdown-table-scroll > table {
+  margin: 0;
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/index.css` around lines 457 - 465, The spacing selector is
applying margin to both the wrapper and the inner table, causing double vertical
spacing; update the CSS so only the wrapper controls spacing by removing
`.chat-markdown table` from the selector list (leave
`.chat-markdown-table-scroll`), or alternatively add a reset rule `margin: 0`
for `.chat-markdown table` after the wrapper styles to cancel the inner table
margin; locate selectors involving `.chat-markdown-table-scroll` and
`.chat-markdown table` and implement one of these fixes so the wrapper handles
spacing exclusively.
🧹 Nitpick comments (1)
apps/web/src/components/chat/ChatTranscriptPane.browser.tsx (1)

169-239: ⚡ Quick win

Consider verifying actual scroll behavior, not just DOM presence.

The test confirms that the scroll wrapper and table elements exist in the DOM, but doesn't verify that horizontal scrolling actually works. Given the long file path in the test data, the test could additionally check that the table overflows the wrapper (e.g., scrollWidth > clientWidth), ensuring the CSS enables scrolling correctly.

💡 Enhanced test assertion

Add after line 234:

       expect(tableScroll).not.toBeNull();
       expect(tableScroll!.querySelector("table")).not.toBeNull();
+
+      // Verify that the table content actually triggers horizontal scrolling
+      const table = tableScroll!.querySelector("table");
+      expect(table!.scrollWidth).toBeGreaterThan(table!.clientWidth);
     } finally {

This verifies that the table's content width exceeds its visible width, confirming that horizontal scrolling is available.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/components/chat/ChatTranscriptPane.browser.tsx` around lines 169
- 239, Update the test "contains completed markdown diff tables within the
transcript row" to assert actual horizontal overflow rather than just DOM
presence: after you locate tableScroll via ".chat-markdown-table-scroll" and the
inner table via tableScroll.querySelector("table"), add an assertion that the
table's scrollWidth is greater than tableScroll.clientWidth (or that
innerTable.scrollWidth > tableScroll.clientWidth), making sure to guard for
nulls so the test fails meaningfully if elements are missing; this ensures the
CSS enables horizontal scrolling for the long file path content.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/web/src/index.css`:
- Around line 457-465: The spacing selector is applying margin to both the
wrapper and the inner table, causing double vertical spacing; update the CSS so
only the wrapper controls spacing by removing `.chat-markdown table` from the
selector list (leave `.chat-markdown-table-scroll`), or alternatively add a
reset rule `margin: 0` for `.chat-markdown table` after the wrapper styles to
cancel the inner table margin; locate selectors involving
`.chat-markdown-table-scroll` and `.chat-markdown table` and implement one of
these fixes so the wrapper handles spacing exclusively.

---

Nitpick comments:
In `@apps/web/src/components/chat/ChatTranscriptPane.browser.tsx`:
- Around line 169-239: Update the test "contains completed markdown diff tables
within the transcript row" to assert actual horizontal overflow rather than just
DOM presence: after you locate tableScroll via ".chat-markdown-table-scroll" and
the inner table via tableScroll.querySelector("table"), add an assertion that
the table's scrollWidth is greater than tableScroll.clientWidth (or that
innerTable.scrollWidth > tableScroll.clientWidth), making sure to guard for
nulls so the test fails meaningfully if elements are missing; this ensures the
CSS enables horizontal scrolling for the long file path content.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1416d56c-a0d5-4b22-9bd5-c5a56b73186b

📥 Commits

Reviewing files that changed from the base of the PR and between a2599a7 and debc30a.

📒 Files selected for processing (3)
  • apps/web/src/components/ChatMarkdown.tsx
  • apps/web/src/components/chat/ChatTranscriptPane.browser.tsx
  • apps/web/src/index.css

@Jay1 Jay1 merged commit 2053d0f into main May 28, 2026
8 checks passed
@Jay1 Jay1 deleted the jcode/fix-react-error-185 branch May 28, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant