|
| 1 | +--- |
| 2 | +status: in-progress |
| 3 | +depends: [] |
| 4 | +specs: |
| 5 | + - specs/behaviors/app-shell.md |
| 6 | +issues: [] |
| 7 | +--- |
| 8 | + |
| 9 | +# Plan: mechanical accessibility fixes across the SPA |
| 10 | + |
| 11 | +## Scope |
| 12 | + |
| 13 | +The third and largest bucket of the `apps/web` accessibility audit: findings |
| 14 | +with **one obviously-correct fix each** and no design decision attached. |
| 15 | +Repeated button names in lists, heading-level skips, missing toolbar |
| 16 | +semantics, unannounced status changes, dates trapped in `title` attributes, |
| 17 | +missing new-tab cues, landmark nesting, and the `Breadcrumbs` component that |
| 18 | +`specs/behaviors/app-shell.md` prescribes but nothing renders. |
| 19 | + |
| 20 | +This branch **stacks on PR #154** (`fix/site-check-153` — header/nav rewrite) |
| 21 | +and **PR #155** (`fix/aria-correctness` — ARIA validity), because it edits |
| 22 | +many of the same files. It is cut from #154 with #155 merged in. |
| 23 | + |
| 24 | +It **complements issue #156**, which holds the audit's *design-decision* |
| 25 | +findings (colour contrast, `document.title`, motion/pause controls, |
| 26 | +`CardTitle` semantics, the `NetworkErrorBanner` "Retry" contradiction). |
| 27 | +Nothing from #156 is implemented here — those need decisions, not fixes. |
| 28 | + |
| 29 | +Only one item is spec-facing, and it is conformance **to** an existing spec: |
| 30 | +`specs/behaviors/app-shell.md` → Breadcrumbs already prescribes an exact |
| 31 | +table of trails. **No spec change is needed anywhere in this plan.** |
| 32 | + |
| 33 | +## Implements |
| 34 | + |
| 35 | +- [app-shell.md](../specs/behaviors/app-shell.md) — **Breadcrumbs**: the |
| 36 | + prescribed trail table is brought to code on all six screens that declare |
| 37 | + one. The existing `Breadcrumbs.tsx` component was already correct and |
| 38 | + complete; it was simply never imported. |
| 39 | + |
| 40 | +## Approach |
| 41 | + |
| 42 | +### 1. Breadcrumbs wiring (the spec-conformance item) |
| 43 | + |
| 44 | +`apps/web/src/components/Breadcrumbs.tsx` renders `nav[aria-label="Breadcrumb"] |
| 45 | +> ol > li` with `aria-current="page"` on the last crumb — correct as written, |
| 46 | +imported by nothing. Wired into the six screens the spec's table names, each |
| 47 | +placed as the first child of the screen's content container (the spec's "row |
| 48 | +below the header"): |
| 49 | + |
| 50 | +| Route | Trail | |
| 51 | +|---|---| |
| 52 | +| `/projects/:slug` | Projects › `<title>` | |
| 53 | +| `/projects/:slug/edit` | Projects › `<title>` › Edit | |
| 54 | +| `/projects/create` | Projects › New project | |
| 55 | +| `/members/:slug` | Members › `<fullName>` | |
| 56 | +| `/tags/:namespace/:slug` | Tags › `<namespace>` › `<title>` | |
| 57 | +| `/account` | Settings | |
| 58 | + |
| 59 | +No `specs/screens/*.md` mentions breadcrumbs at all, so there is no |
| 60 | +contradiction to resolve — app-shell.md is the sole authority. |
| 61 | + |
| 62 | +### 2. Repeated identical button names in lists (SC 4.1.2 / 2.4.6) |
| 63 | + |
| 64 | +A screen-reader user tabbing a list of "Remove / Remove / Remove" has no way |
| 65 | +to tell the rows apart. Each gets an `aria-label` that **contains its visible |
| 66 | +text** (SC 2.5.3) plus the row's subject: |
| 67 | + |
| 68 | +| File | Buttons | Label shape | |
| 69 | +|---|---|---| |
| 70 | +| `modals/ManageMembersModal.tsx` | Edit role, Make maintainer, Remove | `Remove ${fullName}` | |
| 71 | +| `screens/Account.tsx` | Revoke (per session) | `Revoke session on ${device}` | |
| 72 | +| `pages/StaffAccountClaimQueue.tsx` | Approve, Deny | `Approve claim from ${login}` | |
| 73 | +| `screens/ProjectDetail.tsx` | Mark filled, Close | `Close ${role.title}` | |
| 74 | + |
| 75 | +### 3. Heading levels |
| 76 | + |
| 77 | +Three index screens jump `h1` → `h3` because their card components render |
| 78 | +`h3`. **The cards are not changed** — `PersonCard` and `HelpWantedCard` are |
| 79 | +each used in a second context (`TagDetail`, `Home`, `Volunteer`) where they |
| 80 | +sit correctly under a section `h2`. Instead each index screen gains an |
| 81 | +`sr-only <h2>` section heading above its results region, which is both the |
| 82 | +smaller change and the more honest markup: the grid *is* a section. |
| 83 | + |
| 84 | +`ProjectDetail` and `PersonDetail` aside headings go `h3` → `h2` directly — |
| 85 | +they sit under the screen `h1` with no intervening heading, are used nowhere |
| 86 | +else, and keep their existing classes so nothing moves visually. (Heading |
| 87 | +level and visual size are independent.) |
| 88 | + |
| 89 | +`ProjectsIndex` was checked for the same pattern and does **not** have it — |
| 90 | +`ProjectCard` already renders `h2`. No sr-only heading added there. |
| 91 | + |
| 92 | +### 4. `MarkdownEditor` toolbar |
| 93 | + |
| 94 | +The six formatting buttons were a bare `<div>` of buttons named "B", "I", |
| 95 | +"Link"… Now `role="toolbar"` + `aria-label="Formatting"`, each button |
| 96 | +`aria-label`'d with a full name that contains its visible label as a |
| 97 | +substring (B ⊂ Bold, I ⊂ Italic, Link ⊂ Insert link, List ⊂ Bulleted list), |
| 98 | +and a roving tabindex: only the active button is tabbable, |
| 99 | +ArrowLeft/ArrowRight move focus (wrapping), Home/End jump to the ends. |
| 100 | + |
| 101 | +### 5. Status announcements |
| 102 | + |
| 103 | +Three places changed state visually with nothing announced: |
| 104 | + |
| 105 | +- `ProjectDetail` "Copy link" / "Share to Slack" gave **no feedback at all** — |
| 106 | + now `toast.success(...)` via sonner, which this screen's own modals already |
| 107 | + use for exactly this kind of confirmation. |
| 108 | +- `Sponsor`'s "Copy email" swaps its label to "Copied ✓" — visible text kept, |
| 109 | + with an `sr-only role="status"` mirror added. |
| 110 | +- `ProfileEdit`'s "Uploading…" span becomes `role="status"`. |
| 111 | +- `ConnectGitHubBanner` was `role="region"`, which is never announced; the |
| 112 | + banner appears *after* auth resolves, so it becomes `role="status"`. |
| 113 | + |
| 114 | +### 6. `<time dateTime>` for machine-readable dates |
| 115 | + |
| 116 | +`title` is not exposed to most screen readers and never on touch. Every date |
| 117 | +rendered as relative text inside a `title`-only `<span>` becomes |
| 118 | +`<time dateTime={iso} title={absolute}>` — the `BlogIndex.tsx` idiom. |
| 119 | +Covers `ActivityCard` (×2), `ProjectDetail` (×2), `BlogDetail`, `Account`, |
| 120 | +`StaffAccountClaimQueue`, `AccountClaim`. `ProjectCard`'s wrapper |
| 121 | +`title={m.fullName}` is deleted outright — `PersonAvatar` already emits it. |
| 122 | + |
| 123 | +### 7. Structure and one-liners |
| 124 | + |
| 125 | +- `PersonCard` was one giant `<Link>`, so its accessible name concatenated |
| 126 | + avatar + name + project count + every tag chip. Restructured to the |
| 127 | + `ProjectCard` idiom: `<article>` with the `h3` wrapping the link. The hover |
| 128 | + lift moves to the article via `group-hover`, so the affordance is unchanged. |
| 129 | +- `AppHeader`'s two navs render bare links; wrapped in `<ul>/<li>` matching |
| 130 | + `AppFooter`. Flex/gap classes move to the `ul`; `li` contributes nothing. |
| 131 | + Sheet separators sit between the two lists rather than inside one. |
| 132 | +- The mobile sheet's "About" group label was a styled `<p>` → `<h3>` (one |
| 133 | + level below the Radix `SheetTitle`, which renders `h2`), same classes. |
| 134 | +- `HelpWantedIndex`'s bare outer `<aside>` wrapped `FacetSidebar`, which |
| 135 | + renders its own labelled `<aside>` — two nested `complementary` landmarks. |
| 136 | + Outer becomes a `<div>`. (`PeopleIndex`/`ProjectsIndex` render |
| 137 | + `FacetSidebar` directly and never had this.) |
| 138 | +- Result-count badges move **out** of the `h1` into a flex sibling on all |
| 139 | + three index screens, so the heading's accessible name stops mutating as |
| 140 | + filters change. |
| 141 | +- `target="_blank"` links get a new-tab cue: `<span className="sr-only"> (opens |
| 142 | + in new tab)</span>` where visible text exists, appended to the `aria-label` |
| 143 | + where it does not. |
| 144 | +- `ProjectDetail`'s "More ▾" menu trigger gets `aria-label="More actions"`; |
| 145 | + the "What does this stage mean?" dialog trigger gets `aria-haspopup="dialog"`. |
| 146 | + |
| 147 | +## Validation |
| 148 | + |
| 149 | +- [ ] Breadcrumbs render on all six screens the spec's table names, with the |
| 150 | + exact trails prescribed, and each non-final crumb links to its parent. |
| 151 | +- [ ] No two buttons in the audited lists share an accessible name; every |
| 152 | + added `aria-label` contains the button's visible text (SC 2.5.3). |
| 153 | +- [ ] `PeopleIndex` / `HelpWantedIndex` no longer skip `h1` → `h3`; |
| 154 | + `ProjectDetail` / `PersonDetail` aside headings are `h2`. |
| 155 | +- [ ] The `MarkdownEditor` toolbar exposes `role="toolbar"`, named buttons, |
| 156 | + and a working roving tabindex (Arrow/Home/End). |
| 157 | +- [ ] Copy actions on `ProjectDetail` and `Sponsor` announce; `ProfileEdit` |
| 158 | + upload and `ConnectGitHubBanner` are live regions. |
| 159 | +- [ ] Dates expose `datetime`; no date is `title`-only. |
| 160 | +- [ ] Exactly one `complementary` landmark per index screen. |
| 161 | +- [ ] `npm run -w packages/shared build && npm run type-check && npm run lint |
| 162 | + && npm run -w apps/web test && npm run -w packages/shared test` clean. |
| 163 | +- [ ] Browser test — breadcrumbs, toolbar keyboard nav, and the copy toasts |
| 164 | + verified in a real browser. _(for the coordinator)_ |
| 165 | + |
| 166 | +## Risks / unknowns |
| 167 | + |
| 168 | +- **Low.** Almost every change is attribute-level or a wrapper element. |
| 169 | +- The two structural edits (`PersonCard`, `AppHeader` nav lists) touch files |
| 170 | + PR #154 rewrote. Both keep every existing behavior — the sheet's `onClick` |
| 171 | + close handlers, the separators, the NavLink active styling — and are |
| 172 | + covered by the existing `AppHeader.test.tsx` suite plus updated name |
| 173 | + matchers. |
| 174 | +- The `apps/api` suite is deliberately not run: it has a known pre-existing |
| 175 | + Windows fixture failure and no `apps/api` file changes here. |
| 176 | + |
| 177 | +## Notes |
| 178 | + |
| 179 | +_(filled in at closeout)_ |
| 180 | + |
| 181 | +## Follow-ups |
| 182 | + |
| 183 | +_(filled in at closeout)_ |
0 commit comments