okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-clean-3 (321794636): docs and history (cleanup step 3, items 3.0-3.10); release manifest and capability table with checks, history/ with pointers, link check, tools/ split, bench index; owner OK'd the wording 11-082b36e8a02

main
5.7 KiB101 linesraw

16 · Accessibility and long sessions

Across the app · Harness npm run contrast, npm run measure, npm run luminance

Two audiences that overlap more than they look: people who need the interface to accommodate them, and people who will sit in it for six hours. Both are served by the same things — contrast, size, stillness, and not being shouted at.

What is today — verified, not assumed

ClaimEvidence
Every text pairing meets WCAG AAnpm run contrast: 37 pairings pass, both themes, every interactive state
Contrast is measured on rendered pairingsAlpha is composited over ancestors; hover measured separately
Reading measure is 68 charactersnpm run measure at 10, 16 and 22 px, normal and focus mode
Dark-mode brightness is budgetednpm run luminance: no surface > 4,000 px² exceeds luminance 0.15
Reduced motion substitutes, not silencestransform: none, opacity: 1 verified under the OS setting
Materials are gatedReduced-transparency and a manual override produce identical geometry
Controls are capsules, surfaces are notnpm run audit
No glass samples glassnpm run luminance walks every route

Where it falls short

  1. The command palette does not focus its own search field, and nothing traps focus. Fixed. src/lib/focus.ts provides useSurfaceFocus, which waits for the surface to actually report visible before focusing, traps Tab inside while open, and restores the trigger on close. Measured after the fix: focus is on the palette input on open, is still inside after fourteen Tab presses, and returns to the trigger on Escape. Applied to the palette, the shortcuts dialog, the sampling drawer and the setup modal.
  2. Closed overlays are correctly inert, open ones are not. inert={!open} is applied on the palette, context rail, sampling drawer, shortcuts dialog and the serving sheet — so a closed surface is out of the tab order, which is right. An open one still lets focus walk out into the page behind it.
  3. Landmarks are adequate; the outline is not. One <main>, one <aside>, and SectionHead correctly renders <h2 className="h3">. What is missing is the level beneath: card titles are styled <div>s, so <h2> is the deepest level in the document and a screen reader cannot navigate within a section.
  4. Toast announcements exist; engine and stream announcements do not. .st-toasts carries aria-live="polite" and is correct. The engine phase and the arrival of a completed response change silently.
  5. Contrast is verified for text but not for non-text UI — icon buttons, toggle tracks, borders. WCAG 1.4.11 asks for 3:1 on those and nothing measures them.
  6. The reading text size tops out at 22 px and the UI chrome does not scale with it — correct by design, but there is no way to scale the chrome for someone who needs a larger interface overall.
  7. No high-contrast mode beyond the OS media query, which cannot be verified on a machine where it is not enabled.
  8. Long-session fatigue is handled ad hoc — dark accent tinting, ambient rules, no idle loops — but nothing measures it.
  9. The tool-approval card is the highest-stakes interaction in the app and has the least generous target sizing and no visible focus order.

The plan

Substance

  1. Fix the focus drop and add a trap. Done.
  2. Deepen the heading hierarchy. Done, and it uncovered a second defect: every screen had two <h1> elements, because the decorative compact title copy in the scroll collapse was also an <h1>. It is now a <span aria-hidden>. Verified per route: one h1 each, with h2 and h3 beneath.
  3. Announce what changes without user action — engine phase and response completion (aria-live="polite"). Toasts already do this correctly; leave them alone and do not announce streaming tokens.
  4. Extend the contrast probe to non-text UI — 3:1 for icon buttons, toggle tracks, input borders and focus indicators, measured the same way text is.
  5. An interface scale independent of the reading size: 90 / 100 / 110 / 125%, driving a root --st-ui-scale that the type and spacing tokens multiply through. The reading size stays conversation-only, as designed.

Long sessions

  1. A fatigue budget, measured. Extend npm run luminance with a second assertion: in dark mode, the total area of saturated surface on screen must stay under a threshold. This is what the green-button complaint actually was, expressed as a number.
  2. Contrast mode verification: the probe runs a pass with prefers-contrast: more emulated, so the stronger-border path is tested rather than assumed.

Motion

Nothing here is decorative:

ConcernRule
Reduced motionOpacity substitutes for movement; loops that carry no state stop entirely
Focus movementNever animated. Focus is instant, always
Live-region updatesNo animation on the announced element, so the announcement is not delayed
Long-session calmOne loop per region; nothing animates while generating except the caret and the status dot

Verification

  • npm run contrast extended: non-text UI at 3:1, and a prefers-contrast pass.
  • New flow a11y: for each modal, assert document.activeElement is inside the surface on open (this fails today for the palette), then tab to the end and assert focus never leaves; assert every screen has a heading outline deeper than <h2>; assert the approval card is operable by keyboard alone.
  • New luminance assertion: saturated surface area under threshold in dark mode.
  • Manual pass with VoiceOver on Chat: sending, tool approval, completion.
1# 16 · Accessibility and long sessions
2
3**Across the app** · **Harness** `npm run contrast`, `npm run measure`, `npm run luminance`
4
5Two audiences that overlap more than they look: people who need the interface to
6accommodate them, and people who will sit in it for six hours. Both are served by
7the same things — contrast, size, stillness, and not being shouted at.
8
9## What is today — verified, not assumed
10
11| Claim | Evidence |
12|---|---|
13| Every text pairing meets WCAG AA | `npm run contrast`: **37 pairings pass**, both themes, every interactive state |
14| Contrast is measured on rendered pairings | Alpha is composited over ancestors; hover measured separately |
15| Reading measure is 68 characters | `npm run measure` at 10, 16 and 22 px, normal and focus mode |
16| Dark-mode brightness is budgeted | `npm run luminance`: no surface > 4,000 px² exceeds luminance 0.15 |
17| Reduced motion substitutes, not silences | `transform: none`, `opacity: 1` verified under the OS setting |
18| Materials are gated | Reduced-transparency and a manual override produce identical geometry |
19| Controls are capsules, surfaces are not | `npm run audit` |
20| No glass samples glass | `npm run luminance` walks every route |
21
22## Where it falls short
23
241. ~~The command palette does not focus its own search field, and nothing traps
25   focus.~~ **Fixed.** `src/lib/focus.ts` provides `useSurfaceFocus`, which waits
26   for the surface to actually report `visible` before focusing, traps `Tab`
27   inside while open, and restores the trigger on close. Measured after the fix:
28   focus is on the palette input on open, is still inside after fourteen `Tab`
29   presses, and returns to the trigger on `Escape`. Applied to the palette, the
30   shortcuts dialog, the sampling drawer and the setup modal.
312. **Closed overlays are correctly inert, open ones are not.** `inert={!open}` is
32   applied on the palette, context rail, sampling drawer, shortcuts dialog and the
33   serving sheet — so a *closed* surface is out of the tab order, which is right.
34   An *open* one still lets focus walk out into the page behind it.
353. **Landmarks are adequate; the outline is not.** One `<main>`, one `<aside>`,
36   and `SectionHead` correctly renders `<h2 className="h3">`. What is missing is
37   the level beneath: card titles are styled `<div>`s, so `<h2>` is the deepest
38   level in the document and a screen reader cannot navigate within a section.
394. **Toast announcements exist; engine and stream announcements do not.**
40   `.st-toasts` carries `aria-live="polite"` and is correct. The engine phase and
41   the arrival of a completed response change silently.
424. **Contrast is verified for text but not for non-text UI** — icon buttons,
43   toggle tracks, borders. WCAG 1.4.11 asks for 3:1 on those and nothing measures
44   them.
455. **The reading text size tops out at 22 px** and the UI chrome does not scale
46   with it — correct by design, but there is no way to scale the chrome for
47   someone who needs a larger interface overall.
486. **No high-contrast mode beyond the OS media query**, which cannot be verified
49   on a machine where it is not enabled.
507. **Long-session fatigue is handled ad hoc** — dark accent tinting, ambient
51   rules, no idle loops — but nothing measures it.
528. **The tool-approval card is the highest-stakes interaction** in the app and has
53   the least generous target sizing and no visible focus order.
54
55## The plan
56
57### Substance
581. ~~Fix the focus drop and add a trap.~~ **Done.**
592. ~~Deepen the heading hierarchy.~~ **Done, and it uncovered a second defect:**
60   every screen had **two `<h1>` elements**, because the decorative compact title
61   copy in the scroll collapse was also an `<h1>`. It is now a `<span
62   aria-hidden>`. Verified per route: one `h1` each, with `h2` and `h3` beneath.
633. **Announce what changes without user action** — engine phase and response
64   completion (`aria-live="polite"`). Toasts already do this correctly; leave
65   them alone and do not announce streaming tokens.
664. **Extend the contrast probe to non-text UI** — 3:1 for icon buttons, toggle
67   tracks, input borders and focus indicators, measured the same way text is.
685. **An interface scale** independent of the reading size: 90 / 100 / 110 / 125%,
69   driving a root `--st-ui-scale` that the type and spacing tokens multiply
70   through. The reading size stays conversation-only, as designed.
71
72### Long sessions
736. **A fatigue budget, measured.** Extend `npm run luminance` with a second
74   assertion: in dark mode, **the total area of saturated surface on screen** must
75   stay under a threshold. This is what the green-button complaint actually was,
76   expressed as a number.
777. **Contrast mode verification**: the probe runs a pass with
78   `prefers-contrast: more` emulated, so the stronger-border path is tested rather
79   than assumed.
80
81## Motion
82
83Nothing here is decorative:
84
85| Concern | Rule |
86|---|---|
87| Reduced motion | Opacity substitutes for movement; loops that carry no state stop entirely |
88| Focus movement | Never animated. Focus is instant, always |
89| Live-region updates | No animation on the announced element, so the announcement is not delayed |
90| Long-session calm | One loop per region; nothing animates while generating except the caret and the status dot |
91
92## Verification
93
94- `npm run contrast` extended: **non-text UI at 3:1**, and a `prefers-contrast`
95  pass.
96- New `flow a11y`: for each modal, assert `document.activeElement` is **inside
97  the surface** on open (this fails today for the palette), then tab to the end
98  and assert focus never leaves; assert every screen has a heading outline deeper
99  than `<h2>`; assert the approval card is operable by keyboard alone.
100- New luminance assertion: **saturated surface area under threshold in dark mode**.
101- Manual pass with VoiceOver on Chat: sending, tool approval, completion.