# Accessibility-tree name-loss lab

This experiment captures Chromium's computed accessibility output for ten deliberately chosen button fixtures. It is the reproducible artifact for [**Where Buttons Go to Lose Their Names**](https://blog.jasonsuhari.com/where-buttons-go-to-lose-their-names).

The fixture is a failure zoo, not a survey of the web. Its counts show that the selected mechanisms work in the recorded Chromium build; they do not estimate how often those mistakes appear on production sites or predict the exact speech of any screen reader.

## Reproduce

Prerequisites: Node.js 20 or newer.

```powershell
npm install
npx playwright install chromium
npm run capture
```

When run from the repository root with dependencies already installed:

```powershell
node blog-drafts/where-buttons-go-to-lose-their-names/experiment/capture.mjs
```

The script exits nonzero if Chromium's output does not match any declared hypothesis.

## Outputs

- `outputs/accessibility-tree-results.json` records the environment, summary, DOM values, computed role/name/ignored state, ignored reasons, and accessible-name sources for every fixture.
- `outputs/fixture.png` is first-party visual evidence of the rendered controls.

The capture uses Playwright 1.58.2 and Chromium's Chrome DevTools Protocol `Accessibility.getPartialAXTree` method. The browser version is recorded in the JSON on every run.

## Cases

1. Native button content becomes the accessible name.
2. `aria-label` overrides different visible text.
3. Visible child text marked `aria-hidden` leaves an empty name.
4. An icon-only button whose SVG is hidden has an empty name.
5. `aria-labelledby` pulls a name from a hidden element and overrides the visible text.
6. `title` supplies a fallback name to a textless button.
7. Two different buttons are both renamed `More`.
8. A focusable button with `aria-hidden="true"` is ignored.
9. An empty `aria-label` does not erase usable button text.

## Boundaries

- Chromium only; Firefox and WebKit can differ.
- Browser accessibility-tree output only; no assistive-technology speech layer was captured.
- Static fixtures only; no framework hydration, shadow DOM, portals, or dynamic label mutation.
- Ten authored edge cases; no prevalence claim.
