Public: anyone can read this; the crew can change it.

Every page works with a keyboard and a screen reader, and a test fails when a field loses its label or a page its heading #78

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

src/a11y.test.ts now fails if a page loses a label, a heading or a link's name. The rest of the issue is done too. The full bun test run (255 tests) and bun run lint:design both passed.

Notes

shipped production is serving it deploy d2eada7

opened this

src/a11y.test.ts now fails if a page loses a label, a heading or a link's name. The rest of the issue is done too. The full bun test run (255 tests) and bun run lint:design both passed. I didn't run bun x tsc --noEmit: it printed its help text instead of checking, so the type check didn't run here.

What changed

  • New test: it signs in as a sample user and reads the rendered HTML with a small regex parser in the test file. No dependency was added.
  • Pages covered: the clock, the clock with ?q= and no match, a deal page, the client timeline, new deal, a refused page and the signed-out welcome page. I also added People, Profile and Review today's reminders, which the issue didn't list.
  • Checks per page:

- <html lang> is set. - There is exactly one <h1>, and heading levels never skip. - Every non-hidden input, select and textarea has a label (for, wrapping or aria-label). - Every button and link has text or an aria-label. - No tabindex above 0. - Ids are unique on the page.

  • Self-check: one test feeds the parser a bad page and a good one to show it catches what it should.
  • Findings: the test found no label, heading, name or id problems in the existing pages, so the only page-module changes are the live-region attributes below. The test has no check for :focus-visible.
  • Skip link: src/pages/layout.ts now puts "Skip to content" first in the body, pointing at <main id="content">. static/app.css hides it off-screen until it has focus. It uses existing tokens, so lint:design passes. The global :focus-visible outline was already there and I left it.
  • Live regions: the three data-live regions in src/pages/clock.ts and src/pages/deal.ts now carry aria-live="polite". live.js never moves focus, and the test checks it has no .focus( call.
  • README: one line added under "What is real".

I didn't touch contract.json, and no policy cell changed. I made no new component class, so there are no docs/design/areas edits. scripts/gate.ts and scripts/fast.ts don't exist in this repo, so I ran the whole suite instead.

When #30 or #42 lands a new page or form, add its path to the pages list in the test.

🤖 Generated with Claude Code

Closes #47

Changes requested — before the latest push

Box 4 is not met. static/live.js refreshes a region with el.replaceWith(next), so the whole aria-live element is swapped for a new node on each refresh. Screen readers reliably announce changes inside an existing live region. They often say nothing when a new live region is inserted already filled. As written, the polite announcement is mostly decoration.

Fix: put a persistent live container outside the replaced nodes. For example, add one visually-hidden <div id="live-status" role="status" aria-live="polite"> to the layout. After a swap, live.js writes a short message into it, such as "Clock updated". Or change the swap to replace the region's children (el.replaceChildren(...next.childNodes)) so the live element persists. Then drop aria-live from the big section wrappers: today it would read out whole sections, including the deal page's #deal div, on every change.

The test only checks that the attribute is present, so it passes whichever way the region is swapped. Extend it to assert the persistent region exists, or that live.js does not replace the live element itself. Keep the assertion that live.js never calls .focus(.

Boxes 1, 2, 3 and 5 look met: the skip link is first in the body and targets <main id="content">, the parser self-test is good, and the pages are checked. I did not check whether the preview shows the skip link on focus. Box 3's :focus-visible rule was already in app.css; the skip link is the only addition. The change loosens no contract.json cell, adds no new door, and adds no dependency.

commented

I took the review's suggested fix for live announcements. Live changes now go through one hidden status region that is never swapped out, instead of aria-live on the sections live.js replaces. The full bun test run (255 tests) and bun run lint:design pass. I haven't checked the preview.

  • Status region: the layout renders <div id="live-status" role="status" aria-live="polite"> once, visually hidden through a new .visually-hidden class. Pages without live regions, and the plain page, don't get it.
  • Announcement: after live.js swaps the regions, it clears the status text and writes "Updated" into it. Clearing first means two refreshes in a row are both announced. Focus is still never moved.
  • Sections: I removed aria-live from the data-live sections in src/pages/clock.ts and src/pages/deal.ts, so they no longer read out whole.
  • Test: src/a11y.test.ts now asserts that:

- no data-live element carries aria-live; - the persistent #live-status region exists on the clock; - live.js writes to it; - live.js never calls .focus(.

The announcement text is the generic "Updated", not the specific "Clock updated" the review gave as an example. live.js can't tell which page it is on without extra plumbing.

🤖 Generated with Claude Code

Approved

The earlier ask is met: live changes now go through one persistent #live-status region (role=status, aria-live=polite) that live.js writes to, no data-live section carries aria-live, and focus is never moved. The preview serves the skip link and main#content. The a11y test covers the pages listed plus people, profile and reminders, and the parser has its own self-test. No security, contract or dependency changes.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs