Skip to content

fix(www): scroll wide docs tables and label the docs search - #56592

Merged
kitlangton merged 3 commits into
devfrom
docs-mobile-tables
Oct 17, 2026
Merged

kitlangton merged 3 commits into
devfrom
docs-mobile-tables

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

On a phone, wide Markdown tables make the whole v2 docs page scroll sideways. At 390px, cli/keybinds is 716px wide, build/plugins/migrate-v1 596px and console/api/inference 569px, and about ten pages overflow in all. Only cli/config avoided it, by wrapping each table by hand in <div class="docs-table-scroll">. The search box in the search dialog also has no accessible name, only a placeholder.

What Changes

  • A small rehype plugin wraps every rendered <table> in the existing .docs-table-scroll container (overflow-x: auto), so a wide table scrolls inside its own box instead of widening the page. The wrapper has tabindex="0" so keyboard users can scroll it, like the hand-wrapped ones. Tables already wrapped by hand in MDX are left alone.
  • The search input gets aria-label="Search docs".

Verification

cd services/www && bun typecheck && bun run build
bunx astro dev --port 4329
curl -s http://localhost:4329/v2/docs/cli/keybinds/ | grep -o 'class="docs-table-scroll"' | wc -l

The build passes. On the local dev server, cli/keybinds has 13 wrappers for 13 tables, and cli/config keeps exactly 11 wrappers for its 11 hand-wrapped tables, with no double wrapping.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works as described. With astro dev, every Markdown table is wrapped exactly once: 13/13 on cli/keybinds, 2/2 on build/plugins/migrate-v1, 1/1 on console/api/inference. Tables already wrapped by hand on cli/config (11) and console/models (3) aren't wrapped again. bun typecheck and bun run build pass.

Public API: unchanged (docs site only).

One small point inline: the generated wrappers can't take keyboard focus, unlike the ones wrapped by hand.

if (isScroller(node)) return
node.children = node.children?.map((child) =>
child.type === "element" && child.tagName === "table"
? { type: "element", tagName: "div", properties: { className: ["docs-table-scroll"] }, children: [child] }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The wrappers added by hand (e.g. cli/config.mdx, console/models.mdx) also set role="region", an aria-label and tabIndex={0}, so keyboard users can focus the box and scroll it sideways. These generated wrappers get none of that. In browsers that don't make scroll boxes focusable automatically, a wide table can't be scrolled with the keyboard. Adding tabIndex: 0 here would match the hand-wrapped ones. If you also add role: "region", it needs a label, e.g. one taken from the nearest heading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant