Skip to content

Accessible above-table panel tabs with selected state - #3093

Merged
simonw merged 2 commits into
mainfrom
claude/kind-allen-dsdpf8
Nov 20, 2026
Merged

simonw merged 2 commits into
mainfrom
claude/kind-allen-dsdpf8

Conversation

@simonw

@simonw simonw commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Closes:

uv run python tests/fixtures.py /tmp/fixtures.db
uv run datasette /tmp/fixtures.db \
  --plugins-dir=demos/plugins/ \
  --static static:demos/plugins/static
Animated demo showing that the tabs are now keyboard accessible and have selected state
Claude Fable 5.2

The buttons for panels added by JavaScript plugins with makeAboveTablePanelConfigs() gave no indication of which panel was showing. They now show the selected state, and are built as a WAI-ARIA tab set so that state is available to everyone.

Accessibility

  • Selected state - the selected tab has a 3px underline and bolder text, so it does not rely on colour alone, and it has aria-selected="true".
  • Keyboard - only the selected tab is in the tab order. Left and right arrows (swapped in right-to-left pages), Home and End move between the tabs and select as they go. Tab then moves into the selected panel.
  • Semantics - the buttons are role="tab" inside a role="tablist" labelled "Panels". Each panel is a role="tabpanel" labelled by its tab, and is focusable so a panel with no focusable content can still be reached.
  • Focus and touch - tabs and panels have a visible :focus-visible ring, and tabs are at least 44px tall on coarse pointers.
  • Forced colours - unselected tabs have no bottom border at all, rather than a transparent one that high contrast mode would paint, so only the selected tab is underlined there.

Behaviour changes

  • Panels are hidden with the hidden attribute instead of an inline display: none.
  • Whitespace in a plugin name or panel id is replaced with - in the generated element IDs, because ARIA ID references cannot contain spaces. IDs without whitespace are unchanged.
  • Registering another plugin later no longer appends a second, empty pair of wrapper elements, and it keeps the current selection instead of resetting it.
  • The temporary inline styles on the tab controls are replaced by rules in app.css.

Testing

Two new Playwright tests cover the selected state, the ARIA attributes, the keyboard behaviour and late plugin registration. The full Playwright suite passes in Chromium (180 tests). Firefox, WebKit and a real screen reader have not been tested.

To try it:

uv run python tests/fixtures.py /tmp/fixtures.db
uv run datasette /tmp/fixtures.db \
  --plugins-dir=demos/plugins/ \
  --static static:demos/plugins/static

Then visit http://127.0.0.1:8001/fixtures/facetable


Generated by Claude Code

Panels added by makeAboveTablePanelConfigs() are now a WAI-ARIA tablist:
the selected tab has aria-selected and a visible underline, arrow, Home
and End keys move between tabs, and panels are labelled tabpanels.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016BvfqBtaFtNNV8KDiTmMEY
@simonw
simonw merged commit b91f266 into main Nov 20, 2026
13 checks passed
@simonw
simonw deleted the claude/kind-allen-dsdpf8 branch November 20, 2026 03:15
@simonw simonw added this to the Datasette 1.0 stable milestone Nov 20, 2026
@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (e854af7) to head (a05cbe6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3093   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         80      80           
  Lines      14301   14301           
=====================================
  Misses     14301   14301           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants