Repository navigation
Scroll wide research-post tables inside their own container - #1472
Merged
Merged
Conversation
Markdown tables in research posts rendered with no scroll wrapper, so a table wider than the column widened the whole page on phones (the live energy bills post was 441px wide at a 375px viewport). Each table now sits in a TableScroll container with overflow-x: auto and max-width: 100%. The container carries the table's vertical margins, so they still collapse with neighbouring paragraphs, and its shadow, which a scroll container would otherwise clip. When the table overflows, the container becomes a focusable, labelled region so keyboard users can scroll it. The tablet body column gets minWidth: 0, as the desktop one already has, so a wide table can't stretch the flex column either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
Browser check at e47e4f6I checked this in Chromium (the desktop app's built-in browser) against the local website dev server (
|
The independent review saw one cold run in a loaded sandbox exceed Vitest's 5s default; normally the 25 renders take well under a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
Independent review and merge hold
Hold: not merging during Autumn Budget week (through 30 Oct 2026) without the repo owner's OK. I'll check the gates again on 31 Oct. |
MaxGhenis
marked this pull request as ready for review
October 28, 2026 20:27
33 of 35 tasks
This was referenced Oct 29, 2026
Contributor
Author
|
Merged at head cba7262 with an admin squash merge, pinned to that head (merge commit 94831f2).
🤖 Generated with Claude Code |
This branch was successfully deployed
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.
WIP (draft). Not for merging during Budget week (through 30 Oct 2026) without the repo owner's OK.
Problem
Research posts render markdown tables with no horizontal scroll wrapper, so a table wider than the column widens the whole page at phone width. On 28 Oct at a 375px viewport:
/uk/research/budget-2026-energy-bills) was 441px wide, because Table 3 (five columns) is 425px;uk-autumn-budget-2026-briefing) was 527px wide.Change
website/src/components/blog/MarkdownFormatter.tsx: thetablerenderer now wraps each table in a newTableScrollcontainer withoverflow-x: autoandmax-width: 100%. That covers GFM tables and raw HTML<table>(rehype-raw goes through the samecomponentsmap), and also notebook posts, whose markdown cells use the same formatter.<table>. When the table fits the column, the container is the same size as the table, so it looks the same.tabIndex=0,role="region"andaria-label="Scrollable table", so keyboard users can scroll it. A table that fits gets no extra tab stop.website/src/app/[countryId]/research/[slug]/ArticleClient.tsx: the tablet body column getsminWidth: 0, as the desktop column already has. Otherwise a flex item's automatic minimum width would let a wide table stretch the column despite the wrapper.Invariants
<table>sits directly in exactly one[data-table-scroll]container, and there are as many containers as tables (property test over 1–4 tables × 1–8 columns × 1–5 rows).Tests
website/src/__tests__/components/markdown-table-scroll.test.tsx(Vitest):overflow-x: autoandmax-width: 100%;Four of the five fail against
origin/main's renderer. The no-tab-stop test is a guard.Locally on Node 26, which CI pins:
bun run lint,bun run typecheck,bun run format:checkandbun run testinwebsite/all pass (57 files, 534 tests).Browser verification
At 375px the page is now 375px wide on both posts (it was 441px on energy bills and 527px on the briefing). Wide tables scroll inside their containers, and desktop spacing and size don't change. Measurements, the tablet check and the keyboard check are in #1472 (comment).
axiom: n/a: UI-only change
🤖 Generated with Claude Code