Workbench / The TiffinBox Build
S20 · V2·20
The Display, Heard
Volume 2, chapter 20. The kitchen display is checked through Chromium's own accessibility tree, the one screen readers are given, and three of the build's earlier decisions turn out to hurt: stage 18's `content-visibility` left a third of the orders without content for screen readers, disabling a button during its request sent keyboard focus to the page, and new or late orders were never announced. Stage 20 fixes all three (and pays for the first with about 130 ms of rendering at 500 orders, on purpose), adds a batched announcer and a screen wake lock, enlarges small targets, and runs axe on every page. The test that proves it reads the browser's tree through the DevTools protocol, because a DOM-based snapshot would have passed.
Stage 20: the display, heard
The brief
What you'll build.
- accessibility fixes on the display:
contain: contentinstead ofcontent-visibility: autoon cards;aria-disabled(with a pending guard) instead ofdisabledwhile an action runs; header links at least 24 px tall; - an announcer: a visually hidden
role="status"paragraph; new orders (after the first snapshot), orders turning late and failed actions are queued and announced in one sentence every 2 seconds at most; - a screen wake lock, re-acquired when the page becomes visible, its state recorded on the list (
data-wake-lock); web-tests/stage20.py: the display with 60 orders, before (stage 19's CSS and script, served throughpage.route) and after: order headings in Chromium's accessibility tree and focus after pressing Enter on "Accept"; announcements during a burst of five orders; target sizes on every page; axe-core (WCAG 2.2 A and AA rules) on every page.
Why a real company needs this. Kitchens employ people with low vision and blind people, and institutional customers (hospitals, universities, government canteens) require WCAG conformance in procurement. A display that works only by looking at it excludes staff and loses contracts. And accessibility bugs are often introduced by well-meant changes elsewhere (here, a performance optimisation and a double-tap guard), so they need tests that see what assistive technology sees.
Why now. Chapter 20 is accessibility: semantics, names, keyboard and focus, the accessibility tree, ARIA and live regions, and testing. The display (stage 17) is the build's most interactive page, and stages 18 and 19 changed it without looking at the tree.
What you'll have at the end.
- every order in the tree, focus kept through actions, batched announcements, no axe violations on six pages;
- a test that reads the browser's tree, not a DOM simulation;
- ADR-0022: accessibility checks, and the trade-off taken.
Theory to own
- Whose tree? What's the difference between the browser's accessibility tree, axe's view, and Playwright's
aria_snapshot(), and which one do screen readers use? (Companion, Gaps 1.) - Focus during async actions. What happens to a focused button that becomes
disabled, and what doesaria-disabledchange? (Companion, Gaps 3.) - Announcements. What should a kitchen display announce, how often, and through which kind of live region? (Companion, interview Q1.)
- Target size. What does WCAG 2.2's 2.5.8 require, and what are its exceptions?
- Trade-offs. When an optimisation and an accessibility requirement conflict, how do you decide, and who decides?
Build it
Step 1: see the display through the browser's tree
Write the first part of stage20.py: place 60 orders for kitchen 7; open the display twice, once with stage 19's app.css and kitchen.js (served through page.route from git show), once with the current files. For each: count cards in the DOM and order headings in Chromium's accessibility tree (Accessibility.queryAXTree with role heading, through a CDP session); focus "Accept" on a card, press Enter, wait for "Accepted", and report where focus is.
Checkpoint. A baseline that shows the stage 19 problems.
Step 2: keep every card in the tree
Replace content-visibility: auto; contain-intrinsic-size: … on .ticket with contain: content, and re-run the profile from stage 18.
Checkpoint. All 60 headings are in the tree; record what it costs at 500 orders.
Step 3: keep focus through an action
In the delegated click handler, mark the button aria-disabled="true" instead of disabled, ignore clicks while it's set, and remove it on failure. Style button[aria-disabled="true"] (reduced opacity, a progress cursor). The render path already moves focus to the card's new first button when focus was inside the card's actions; with focus no longer thrown to <body>, that now works.
Checkpoint. After Enter on "Accept", focus is on the same card's "Ready".
Step 4: announce what matters
Add <p id="announce" class="visually-hidden" role="status"></p> to the display page and a .visually-hidden utility (clip, 1 px, absolute). In kitchen.ts, announce(msg) queues messages and, at most every 2 seconds, writes one sentence: "New order o42." or "5 new orders: o61, o62, o63 and 2 more.", followed by any late or failed messages. New orders are announced only after the first snapshot (a reload doesn't announce 60 "new" orders); tick announces an order when it turns late; a failed action announces its message.
Checkpoint. A burst of five orders in a second produces one announcement.
Step 5: targets and automated rules on every page
Measure every visible link, button, input and select on six pages at 375 px; report those under 24 × 24 that aren't inside running text. Inject axe-core and run its WCAG 2.2 A and AA rules on each page (in a context with bypass_csp, because axe is injected as an inline script, which the pages' CSP refuses). Fix what's found, then re-run stages 14, 17 and the validators.
Checkpoint. No small targets, no axe violations; earlier stages still pass.
Senior and architect lens
1. Accessibility regressions come from other people's good ideas. Nothing in this stage was a forgotten label. A performance optimisation (stage 18), a double-tap guard (stage 17) and silence by default (no announcements) each made sense locally. Only a test that looks at the same tree as a screen reader catches that kind of regression.
2. ADR-0022: accessibility checks and trade-offs. Write it with these points:
- Decision: every page meets WCAG 2.2 AA; the display is additionally tested through the browser's accessibility tree (DevTools protocol), for focus after each action, and for announcements.
- Checks in CI: axe (2.2 A/AA) on every page; target sizes; Chromium tree counts against DOM counts for lists; keyboard scripts asserting focus never lands on
<body>after an action; stage 14's contrast, reflow and forced-colours audit. - People: a screen-reader user tests the display each quarter; their findings become automated checks.
- Trade-off recorded:
content-visibilityremoved from navigable content (about 130 ms slower load at 500 orders, throttled); recovered in stage 21 by a different technique, not by hiding content. - Revisit when: browsers expose skipped content to assistive technology (then re-measure), or the display grows past what can be rendered at once (accessible virtualisation, with counts and positions).
3. Test against the real consumer. The test reads Chromium's tree because that's what users' tools read; a DOM-based snapshot (Playwright's) and a rule engine (axe) both said everything was fine. The same principle as stage 16's contract test (check the real response) and stage 18's profile (measure the real device class).
4. Announcements are a product decision. What a blind cook hears during a rush ("5 new orders") is as designed as what sighted cooks see. Rate, wording and priority are choices to make with users, and to test.
5. Trade-offs need a default and a record. When performance and accessibility conflicted, the default (accessibility) decided, and the cost was measured and written down with a plan to recover it. Without the record, the next performance pass reintroduces the bug.
What breaks first, and when it's addressed:
| Pressure | What breaks | Where it's addressed |
|---|---|---|
| loading 500 cards takes 221 ms on a throttled CPU | everything is rendered at once | stage 21 (first screen first, the rest streamed, all in the tree) |
| a screen-reader user wants to hear a specific station only | one announcer for the whole kitchen | stage 25 (filters and per-station views as state) |
| axe is injected with CSP bypassed in tests | the production CSP isn't tested together with axe | stage 28 (the suite's CSP tests; stage 26 pins axe-core and still injects it with CSP bypassed) |
| no real assistive technology in CI | the tree is checked, the experience isn't | quarterly user testing (ADR-0022), plus stage 26's keyboard suites |
| the customer pages haven't had a screen-reader session | only automated checks | stage 26 (keyboard and accessibility-tree suites for the customer pages) |
Evidence
stage20.pyoutput (before and after, announcements, targets, axe) is in the README.- The stage 18 profile re-run with
contain: contentis recorded next to the stage 18 numbers, with the trade-off. stage14.py(failures: 0),stage17.py,validate.shandcheck-js.shpass.- ADR-0022 is committed.
Carry forward
- Reading the browser's tree becomes a helper in stage 26's test suite, used for every list and live region.
aria-disabledwith a pending guard is the pattern for every in-flight action from now on (stage 22's components build it in).- The announcer moves into a shared module in stage 21, used by search and the customer's order tracking.
- The load cost is stage 21's first problem to solve.