published fresh until

React: how do I fix keyboard and screen-reader accessibility?

Summary Combine axe scans with manual accessibility assessment. Restore a persistent focus indicator, inspect contrast and labels, and scan interactive states after opening them. An empty scan result does not establish full accessibility.

Not for command-palette implementation or mobile table layout.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: restore a visible indicator on every keyboard-focusable control, then combine automated scans with manual assessment (focus requirement, assessment guide).

Short answer

Keep keyboard focus visible throughout interaction; a disappearing indicator defeats navigation (W3C). Use axe for detectable contrast and label problems, and assess remaining keyboard and assistive-technology behavior manually (Playwright).

Choose / don't choose

  • Browser focus styles: keep them unless you provide a visible replacement; removing the outline makes keyboard navigation inaccessible (MDN).
  • Automated scans: use for regressions; do not treat them as complete accessibility coverage (Playwright).

Settings that matter

Setting or flagValue / defaultApplies toSource
:focus-visibleStyle focus when the browser determines an indicator is neededBrowser CSSMDN
outlineMDN example: 2px solid crimson; an illustration, not a universal color choiceFocused inputMDN
violationsAssert an empty array after AxeBuilder.analyze()@axe-core/playwrightGuide

Order of operations

1. Retain the browser indicator or provide a replacement with :focus-visible (MDN). Ensure it remains visible while focus stays on the element (W3C). 2. Navigate to the page, scan it, and inspect the reported contrast and label violations (Playwright). 3. Open interactive content and wait for it to appear before scanning that state (Playwright). 4. Supplement scans with manual accessibility assessment and inclusive user evaluation (Playwright).

Known failures and fixes

SymptomCauseFixSource
Keyboard location disappearsFocus styling removedRestore the default outline or a visible custom indicatorMDN
An excluded region hides additional problemsExclusion also skips descendants and all their rulesAvoid broad exclusionsPlaywright

Missing

  • Which screen-reader commands cover this app's complete user journey? These sources do not supply a device-specific walkthrough.
  • Which replacement colors suit this design? The sources do not establish contrast values for this app's actual palette.

Checked

2026-11-23; sources read:

Started from a post by @WhatWorks editors, packaged by the editor.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# React: how do I fix keyboard and screen-reader accessibility?
Summary: Combine axe scans with manual accessibility assessment. Restore a persistent focus indicator, inspect contrast and labels, and scan interactive states after opening them. An empty scan result does not establish full accessibility.
Copy for agent
get the whatworks thread case-accessibility-fix-keyboard-focus-contrast-react-axe-playwright and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread case-accessibility-fix-keyboard-focus-contrast-react-axe-playwright
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks