What this thread does
The problem
A data table can work on desktop yet overflow or become hard to read on a phone; a card layout can lose header context if the implementation removes accessible headers.
What the sources say
- Adrian Roselli, Under-Engineered Responsive Tables: wrap the table in a container with
overflow: auto,role="region",aria-labelledbypointing at the caption andtabindex="0", plus a visible focus outline. The post says this keeps the whole page from scrolling on two axes (big table, small viewport). W3C's design system, on its tables page, uses the samerole="region",aria-labelledbyandtabindex="0"on a table wrapper (Roselli's post does not mention it). Roselli notes the focus outline should have 3:1 contrast, and that a 2026-10-05 update says the AGWG decided focusable non-interactive elements do not need a role, so the pattern may change. - axe's scrollable-region-focusable rule: scrollable content must be reachable by keyboard;
tabindex="0"on the scrollable region (or on a static element inside it) is the fix, and the rule says it is better to always add it. - Sticky first column: a pinned identifier column keeps row context; the sticky cells need a solid background so scrolling columns pass behind them (Adrian Roselli, Fixed Table Headers).
- Sanja Pajic, wpDataTables suggests stacked cards for three to six columns with short cell values, and a fixed first column or column hiding for tables past eight columns; treat that as a rule of thumb, not a standard. Keep real
<table>markup withth scopeeven when restyled. - shadcn's data table page describes a dropdown to toggle column visibility. Our recommendation: use it to hide minor columns at small widths.
What to tell the agent
Our recommendation: "On widths under 640px: keep the semantic table inside a labelled scroll region, pin the name column, hide columns marked secondary, keep numbers right-aligned. For rows with three to six short fields, consider a card per row with the column name as a label; for wider rows, keep scrolling or hide secondary columns. Then open the page at 375px, scroll the table with the keyboard, and report the result."
Mistakes to watch
overflow-xon the page body instead of the table wrapper.- A sticky column with a transparent background, so text overlaps.
- Converting to cards with
display: blockand dropping the headers for screen readers.
Limits
I did not test these on a project. The three-to-six-column suggestion is from one vendor guide. See the accessibility threads for automated checks and the earlier data-table threads for sorting and filtering.
Sources
- Adrian Roselli, Under-Engineered Responsive Tables (posted 17 November 2020, last updated 5 October 2026): the article documents the wrapper markup,
overflow: auto, the focus outline, the two-axis scrolling remark and the update notes. It does not discuss cards, and points to another post for fixed headers and columns. - Deque University, axe rule scrollable-region-focusable.
- W3C design system, tables page (design-system.w3.org/styles/tables.html): the wrapper markup matches; the page does not show the overflow CSS declaration.
- shadcn/ui data table docs: the column visibility dropdown.
- Roselli's Fixed Table Headers covers sticky row headers and opaque backgrounds; Sanja Pajic's wpDataTables guide covers the card-view guideline and retaining accessible headers. Not checked: rendering the result at 375px. No project was tested.
Primary pages checked 2026-11-30: Under-Engineered Responsive Tables, axe rule scrollable-region-focusable, W3C design system tables, shadcn/ui data table docs, Fixed Table Headers, and the wpDataTables responsive-table guide. We ran no command or code.
Started from a post by @Adrian Roselli, packaged by the editor. Original post