fix: restore horizontal scroll for wide tables in preview#206
Open
legolev wants to merge 1 commit into
Open
Conversation
Wide tables were clipped off the right edge of the preview with no way to reach the hidden columns. The markdown preview article uses `overflow-x: hidden`, and since a5fda8e the table used `table-layout: fixed; width: 100%`, which forces every column to share the pane width. When the combined cell padding (or non-wrapping content such as CSV `white-space: nowrap` cells) exceeds the available width, the table overflows and is silently clipped instead of scrolling. Make the table a horizontal scroll container like GitHub does (`display: block; width: max-content; max-width: 100%; overflow-x: auto`). Cells keep the existing wrap rules, so tables that fit still wrap and never show a scrollbar; only genuinely wide tables scroll. Add a matching `@media print` override so PDF/HTML export keeps wrapping tables to fit the page (paper cannot scroll). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Wide tables in the markdown preview run off the right edge and the extra columns are unreachable — there is no horizontal scrollbar, and window zoom doesn't help (it scales everything proportionally, so the overflow ratio stays the same). Most visible in a narrow window, in split view, and with CSV tables. Reported on Windows.
Root cause
The preview article (
.markdown-body) isoverflow-x: hiddenby design. Since a5fda8e the table uses:table-layout: fixed; width: 100%forces every column to share the pane width. When it can't compress any further — the combined cellpadding: 6px 13px(26px/cell) across many columns exceeds the available width, or a cell can't wrap (e.g..csv-datacells arewhite-space: nowrap) — the table overflows and is silently clipped byoverflow-x: hiddeninstead of scrolling.Fix
Make the table a horizontal scroll container, the way GitHub's markdown CSS does:
The existing per-cell wrap rules (
white-space: normal; overflow-wrap: anywhere) are kept, so tables whose content fits still wrap and never show a scrollbar — only genuinely wide tables scroll. A matching@media printoverride restorestable-layout: fixedfor PDF/HTML export, so exported tables wrap to fit the page (paper can't scroll).Notes / trade-off
src/styles.css, no markup or JS changes, sodata-sourceposon tables (scroll-sync) is untouched.Testing
npm run build— passes.npm run test:workflows— 25/25 pass (includes the HTML-export tests).window.print()→@media print) still wraps.