Plan: Worker-portal reflow at 320 px and the error and warning badges (#560, #3039)
Status: Done (2026-10-27) — !1816
Epic: none — #560 came from the Stage 5 MR3 review of the worker-portal redesign (#460, epic &51)
Issues: #560 (T1) · #3039 (T3) · U1 → #3039 · U2, U3 → #560 · follow-ups #3043, #3044, #3045
Branch: fix/web-reflow-and-status-badges (one branch, three commits, one MR)
This is a Design + Scope plan: GitLab owns tracking, the two issues carry the implementer brief, and the plan freezes when U1 starts.
Erratum (2026-10-27): D5’s ninth page is the case’s determination tab, not its household tab: a caseworker’s case landing already opens on household (rulesets/georgia/composition/case_detail.toml lists it first), and the determination tab carries .det-meta and .det-strip, which D4 expects to fix.
Context
The worker shell is one template, services/canopy-web/templates/base.html. It renders a sidebar layout (:26-107) or a topbar layout (:109-177), chosen by the pack’s nav_position, and all four shipped packs choose sidebar (rulesets/*/theme.toml). .layout-sidebar is a fixed var(--orchard-nav-width, 240px) 1fr grid at every width (services/canopy-web/static/css/canopy-web.css:94-98). 1fr is minmax(auto, 1fr), so a wide table widens the column instead of shrinking. .main-content has overflow-x: hidden (:221-225), so overflowing content is clipped and cannot be scrolled to. No @media rule touches the shell; only component grids collapse, at 1024, 900, 720 and 460 px. Below about 900 px the sidebar takes 240 px. At 375 px a .data-table (454–458 px) is clipped (#560 inventory).
There are 41 <table> elements in 34 templates. 34 of them carry .data-table (:455-476). The other 7 carry .u-table, which has no CSS rule, or no class at all: services/canopy-web/templates/applications/process.html, cases/_enrollment_continuations.html, cases/_wic_terminations.html and services/canopy-web/templates/cases/tab_determination.html. None sits in a scroll container. Askama macros with a caller() body already exist (templates/_primitives/orchard.html:17-29). Five of the 34 table templates do not import _primitives/orchard.html.
The CSP is script-src 'self'; style-src 'self' (services/canopy-web/src/csp.rs:34-44). security.adoc §CSP bans inline script, inline style= and inline handlers. The shell already binds the theme toggle from the external services/canopy-web/static/js/canopy-web.js on DOMContentLoaded (:36-46), and the nav toggle follows that precedent. The portal already needs JavaScript: case-detail tabs and dashboard panels load through htmx.
The four packs and the built-in default (services/canopy-web/src/theme.rs:98-160) carry the same semantic tokens. theme.rs emits them for light, [data-theme="dark"] and system-dark (:180-234). #3035 moved .u-badge-success and .u-badge-error-solid onto their -bg/-text pairs (canopy-web.css:913-931) and audited the CAPS badge in both themes (tests/e2e/specs/caps.spec.ts:34-56). .u-badge-error and .u-badge-warning have no rule:
-
cases/tab_categories.html:31renders error for "Not Eligible". -
cases/tab_authorization.html:28renders warning for a non-active authorization. -
cases/tab_work_req.html:31renders error forsanctionedand warning for any other status exceptcompliant. The issue listssanctionedunder warning; the template maps it to error.
The governing criterion is WCAG 2.1 SC 1.4.10 Reflow: content at 320 CSS px wide, the same as 1280 px at 400 % zoom, must not scroll in two dimensions. Content that needs a two-dimensional layout, such as data tables, is exempt. The design reference design/canopy-web/responsive/narrow.jsx picks a single breakpoint at 900 px.
Scope
In scope:
-
U1 (#3039): the error and warning badge rules; a unit test that checks AA for every pack’s semantic pairs; e2e audits with computed-colour checks in light and dark.
-
U2 (#560): a
table_scrollmacro; all 41 tables wrapped in it; a template-wide test for that. -
U3 (#560): below 900 px the nav collapses behind a Menu button, in both layouts, with the narrow CSS the responsive spec finds; the
responsivePlaywright project.
Out of scope:
-
Card-row table collapse, the off-canvas drawer with a scrim (both from the design reference
narrow.jsx,narrow-tables.jsx), and atabindexthat applies only when a table actually overflows: #3043. D2 says why this plan uses an in-flow menu. -
Responsive coverage beyond D5’s pages: #3044. That means the supervisor, analyst, studio and admin pages; the case-detail scroll and card-grid shells; the other case-detail tabs;
services/canopy-web/templates/applications/process.html; and the topbar layout, which no shipped pack uses, so e2e cannot reach it. -
A CSS rule for
.u-table: #3045. -
canopy-portal (the applicant portal, ADR-008) and WCAG 2.2-only criteria such as 2.5.8 and 2.4.11.
Design
D1 — breakpoints. One new shell breakpoint at @media (max-width: 900px). It matches narrow.jsx, the issue, and the existing .customize-hero rule (canopy-web.css:1600). A second block at @media (max-width: 600px) covers only dense utility grids and page padding (D4). Component rules at 1024, 720 and 460 px stay as they are.
D2 — navigation disclosure (U3). Below 900 px the nav becomes a WAI-ARIA disclosure button, not a modal drawer. The panel opens in the page flow under the nav bar, so it needs no focus trap, no inert and no scrim, and focus order matches visual order. The design’s off-canvas overlay would need a modal trap and an inert background (#3043).
-
Markup in
base.html, sidebar layout:-
.nav-logosits in a new<div class="nav-head">, followed by<button type="button" class="nav-toggle" aria-expanded="false" aria-controls="nav-panel" data-nav-toggle>. -
The button holds an
aria-hidden="true" focusable="false"inline SVG of threerects withfill="currentColor", and the visible textMenu, which is the accessible name. The name does not change when the menu opens;aria-expandedcarries the state. -
.nav-itemsand.nav-usermove into<div id="nav-panel" class="nav-panel">.
-
-
Markup in
base.html, topbar layout: the same button after.nav-logo;.nav-itemsand the right-hand cluster (div.u-ml-auto) move into the same#nav-panel. Only one layout renders per page, so the id is unique. -
CSS at desktop width:
-
.nav-toggle { display: none }; -
.sidebar .nav-panel { display: flex; flex-direction: column; flex: 1 }; -
.topbar .nav-panel { display: flex; align-items: center; flex: 1; gap: 1.5rem }; -
.nav-head { display: flex; align-items: center; justify-content: space-between }; -
.layout-sidebarbecomesvar(--orchard-nav-width, 240px) minmax(0, 1fr).Desktop looks the same.
-
-
CSS in the 900 px block:
-
.layout-sidebar { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr }; -
.sidebar { overflow-y: visible }; -
.nav-toggle { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .75rem; margin-right: .75rem; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; font: inherit; font-weight: 600 }; -
.sidebar:has(.nav-toggle[aria-expanded="false"]) .nav-panel, .topbar:has(.nav-toggle[aria-expanded="false"]) .nav-panel { display: none }; -
.topbar { flex-wrap: wrap; height: auto; min-height: 56px },.topbar .nav-panel { flex-basis: 100%; flex-direction: column; align-items: stretch },.topbar .nav-items { flex-direction: column }.aria-expandedis the only state, read by both CSS and JS. White text on--orchard-nav-bgis the existing nav-item pairing, and the global gold:focus-visiblering applies.
-
-
JavaScript:
initNavToggle()incanopy-web.js, bound onDOMContentLoadedbeside the theme binding.-
It finds
[data-nav-toggle]and itsaria-controlspanel, and returns without effect if either is missing. -
A click flips
aria-expanded. -
A
keydownlistener on the enclosing<nav>handles Escape. When the menu is expanded and the button is displayed (getComputedStyle(toggle).display !== 'none'), it collapses the menu and focuses the button. -
No Alpine and no inline handler.
-
-
Keyboard and screen readers:
-
Tab reaches the button right after the skip link and the logo. It is announced as "Menu, button, collapsed".
-
Enter or Space expands it. The next Tab enters the first nav link, because the panel follows the button in DOM order.
-
Escape returns focus to the button.
-
Every link is a full page load, so the menu starts collapsed on each page.
-
D3 — table strategy (U2). Wrap each table in a template. A CSS-only fix (display: block; overflow-x: auto on the table) would remove table semantics in WebKit’s accessibility tree, and tablets are likely Safari.
-
The macro goes in
_primitives/orchard.html:{% macro table_scroll(label) %}<div class="u-table-scroll" role="region" aria-label="{{ label }}" tabindex="0">{{ caller() }}</div>{% endmacro %}. -
tabindex="0"lets a keyboard user scroll the region, as axe’sscrollable-region-focusablerequires. The label names the region when a screen reader enters it. -
Each of the 41 tables becomes
{% call o::table_scroll(label="…") %}<table …>…</table>{% endcall %}. -
The label is a static string: the table’s visible heading or caption, or failing that the section’s heading (for example "COA categories", "Notices", "Work-standard basis"). Tables repeated per member share one label.
-
Each template adds
{% import "_primitives/orchard.html" as o %}if it lacks it. Five table templates do:cases/_enrollment_continuations.html,cases/_work_standard_basis.html,admin_security/_body.html,device/_body.htmlandcase_detail_summary.html. The implementer finds the 34 templates withgrep -rl '<table' services/canopy-web/templates, and the labels come from each table’s own heading at the call site; the plan does not pre-list them. -
Table classes stay as they are.
-
CSS:
.u-table-scroll { max-width: 100%; overflow-x: auto }. -
No minimum table width is forced: cells wrap, and the region scrolls only when a cell’s longest word or id is wider than the viewport. Readable narrow tables are #3043’s card rows.
D4 — other narrow CSS (U3).
-
900 px block:
.top-bar { flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem };.page-body { padding: 1rem }. -
600 px block:
.u-grid-2, .u-grid-cols-2, .u-grid-cols-3 { grid-template-columns: minmax(0, 1fr) }. -
Then the D5 spec’s overflow report is the work list. For each element it names on a covered page, add a rule inside the two blocks:
minmax(0, …)columns;flex-wrap;overflow-wrap: anywherefor ids and long tokens. Expected cases:.det-meta'srepeat(4, 1fr)(:3434) and.det-stripon the default case-detail tab. -
Any fix that needs a template change other than the D3 wrapper is recorded as an erratum. The page is never dropped from the spec.
D5 — the responsive Playwright project (U3).
-
Project in
tests/e2e/playwright.config.ts:{ name: 'responsive', dependencies: ['auth-setup'], use: { storageState: 'auth/caseworker.json' }, testMatch: /specs\/responsive\.spec\.ts/ }.responsivejoins thecaseworkerproject’s exclusion lookahead (:188) and thejourneyproject’sdependencies(:569-594), so the journey lane still runs after it. -
Spec
tests/e2e/specs/responsive.spec.ts:-
Viewports:
phone-320(320×800), the SC’s own width, stricter than the issue’s 375; andtablet-768(768×1024). Each gets its owndescribewithtest.use({ viewport }). -
Pages:
/(ready on[data-panel-slug="worker-dashboard-at-a-glance-panel"]);/dashboard/customize,/cases,/applications,/notices,/appeals,/renewals; the case landing/cases/{findApproved().householdId}?program=snap; itshouseholdtab, throughgotoWorkerCaseSection. -
Readiness after
gotoPortal:awaitLazyFragments(page), thenexpect(page.locator('.htmx-request')).toHaveCount(0). No sleeps.
-
-
One test per page and viewport (18) asserts:
#nav-panelis hidden, and.nav-toggleis visible witharia-expanded="false";document.documentElement.scrollWidth ⇐ innerWidth;overflowing(page)is[].overflowing(page)ispage.evaluateoverdocument.body.querySelectorAll('*'). It keeps each element whosegetBoundingClientRect()haswidth > 0andright > innerWidth + 1, unlessel.parentElement?.closest('.u-table-scroll')is non-null. It returns up to tentag#id.class right=strings for the failure message. Only content inside a wrapper is excepted; the wrapper itself must fit the viewport. Hidden elements measure zero width;.skip-navand.u-sr-only-abssit atleft: -9999pxand never match. The element-level check catches content that.main-content'soverflow-x: hiddenclips, whichscrollWidthalone would miss. -
Drawer test at 320 on
/: click Menu:aria-expanded="true", the Case Search link is visible, andoverflowingis still[];runAxeAudit({ name: 'responsive-nav-open-320', severity: 'serious', scope: 'nav' }); Tab focuses the first.nav-item; Escape collapses the menu and the buttontoBeFocused(). -
Table test at 320 on
/notices:runAxeAudit({ name: 'responsive-table-scroll-320', severity: 'serious', scope: '.u-table-scroll' }). -
Desktop test at the default 1280×720:
.nav-toggleis hidden, and#nav-paneland its links are visible.
D6 — #3039 badge rules (U1). After .u-badge-error-solid:
-
.u-badge-success, .u-badge-error, .u-badge-warning { font-size: .75rem; padding: .125rem .625rem }. The success rule loses its own two declarations, so the three badges that share template slots match in size. -
.u-badge-error { background: var(--orchard-error-bg); color: var(--orchard-error-text) };.u-badge-warningthe same with thewarningtokens. -
The block comment records the ratios. 12 px at weight 500 is normal text, so the floor is 4.5:1.
| Badge | Light (all four packs and the built-in default) | Dark (also system-dark) |
|---|---|---|
|
|
|
|
|
|
D7 — Reflow conformance. After U3, SC 1.4.10 is met and asserted on D5’s nine surfaces at 320 and 768 px: caseworker role, tabs shell, sidebar layout. Tables scroll inside their own focusable region, which the SC’s data-table exception allows. Every other worker page gets the shared nav and table fixes but no assertion. Not conformance-verified until #3044: the role-only pages (team queue, Studio, audit log, security admin, ops quarantine, device); the scroll and card-grid shells; the other case-detail tabs; the topbar layout.
D8 — battery cost. The spec makes 19 page loads plus two scoped axe runs on one Playwright worker: about 50–60 s. U1’s TANF test adds about 8 s (it builds a case) and the journey audit about 2 s. Total: about +70 s of e2e wall time. If the measured spec exceeds 90 s, the 768 pass shrinks to / and /notices, recorded as an erratum.
Units (weights by complexity) — U1 → U2 → U3
Weights: 1 trivial · 2 small · 3 medium · 5 large · 8 very large. One unit is one commit on the shared branch, at the maintainer’s direction to batch related issues into one battery run. Each commit passes cargo xtask test on its own. The one MR carries Closes #560 and Closes #3039.
U1 (w1, #3039) — fix(web): give the error and warning badges their AA token pairs
Files: services/canopy-web/static/css/canopy-web.css, services/canopy-web/src/theme.rs (tests), tests/e2e/lib/axe.ts, tests/e2e/specs/worker-portal-tanf-actions.spec.ts, tests/e2e/specs/journey-medicaid-chip-screen-and-enroll-medicaid-first.spec.ts, docs/modules/ROOT/pages/design/design-system.adoc, CHANGELOG.adoc.
Tests:
-
theme.rs: a NEW test-only helper in its#[cfg(test)] mod tests,fn wcag_contrast(fg: &str, bg: &str) → f64, parses#rrggbb, applies WCAG 2.1’s relative-luminance formula (sRGB linearisation,0.2126 R + 0.7152 G + 0.0722 B) and returns(L1 + 0.05) / (L2 + 0.05)with the lighter colour asL1.wcag_contrast_pins_the_formulaasserts 21.0 for#000000/#ffffffand 5.18 (to two decimals) for#8e510f/#fbe6c8, so a wrong formula cannot pass the next test.every_shipped_pack_semantic_pair_meets_aa: for eachrulesets/*/theme.toml, throughThemeConfig::load, and forThemeConfig::default(), light and dark, each of the error, warning, success and info-bg/-textpairs is at least 4.5:1; it assertsgeorgiawas among the packs read; a colour that is not#rrggbbfails with the pack’s name. -
axe.ts:expectTokenPair(locator, bgToken, textToken)reads each token fromgetComputedStyle(document.documentElement), refuses a value that is not#rrggbb, and assertstoHaveCSS('background-color' | 'color', 'rgb(r, g, b)'). -
worker-portal-tanf-actions.spec.ts, 'the pending work-requirement badge meets AA contrast in light and dark (#3039)':new SnapCaseBuilder().build()andcreateTanfCase(householdId, headPersonId); the work requirement’s status defaults topending(services/canopy-tanf/migrations/20260325000000_create_tanf_tables.sql:99); open the full page/cases/{hh}?program=tanf&focus_section=work-req(the bare tab fragment loads no stylesheet); expect[data-work-requirement] .u-badge-warningto have textpending;expectTokenPairandrunAxeAudit(serious, scoped);settleDarkTheme(page, 'worker'), then both again. -
Medicaid CHIP journey, step 6, after
step-09(:525-531): the same pair of checks onsofiaChildRow.locator('.u-badge-error')(the row locator the step already holds, so only one badge matches and Playwright’s strict mode is satisfied), in light and dark; then restore thedata-themeattribute read beforehand. -
The colour check fails if a rule is deleted; the axe check alone would not, because unstyled text passes.
Docs: design-system.adoc §3.1, the "Solid badges" bullet becomes "Status badges" and lists all four classes with the D6 ratios. CHANGELOG === Fixed: a #3039 entry.
U2 (w3, #560) — fix(web): scroll every worker-portal table inside a keyboard-reachable region
Files: services/canopy-web/templates/_primitives/orchard.html, templates/_primitives/_smoke.html, the 34 table templates, services/canopy-web/static/css/canopy-web.css, services/canopy-web/tests/primitives_test.rs, docs/modules/ROOT/pages/design/design-system.adoc, CHANGELOG.adoc.
Tests (primitives_test.rs):
-
table_scroll_wraps_its_body_in_a_named_focusable_region: asource=wrapper as at:126-141. The output containsclass="u-table-scroll",role="region",aria-label="Notices",tabindex="0"and the caller body._smoke.htmlgains atable_scrollblock, under its every-macro contract; its caller body is a<p>, not a<table>, so the template walk below still counts exactly 41 tables. -
every_template_table_sits_in_a_table_scroll: walkconcat!(env!("CARGO_MANIFEST_DIR"), "/templates")withwalkdir; for each<tablefound, the text before it, trailing whitespace trimmed, must end in%}, and the last{%before that must open{% call o::table_scroll(or{%- call o::table_scroll(; a failure names the file and line; a final assertion counts 41 tables, so the walk cannot pass on an empty directory. -
Existing render tests that assert table markup (
api/cases.rs:1835,dashboard/panels/my_queue.rs:1055,medicaid_tab/tests.rs:176) keep their assertions.
Docs: design-system.adoc §3.7 gains a TableScroll row (table_scroll). CHANGELOG === Fixed: the #560 entry, covering tables.
U3 (w5, #560) — fix(web): collapse the worker nav behind a Menu button below 900 px
Files: services/canopy-web/templates/base.html, services/canopy-web/static/css/canopy-web.css, services/canopy-web/static/js/canopy-web.js, services/canopy-web/src/api/notices.rs (tests), tests/e2e/playwright.config.ts, tests/e2e/specs/responsive.spec.ts (new), docs/modules/ROOT/pages/design/design-system.adoc, CHANGELOG.adoc, this plan and docs/modules/ROOT/nav.adoc (the close).
Tests:
-
notices.rs, besidethe_list_renders_in_both_chromes:the_nav_menu_button_controls_the_panel_in_both_chromes. Foris_sidebartrue and false: the D2 button markup appears exactly once, andid="nav-panel"exactly once;id="nav-panel"comes before the firstclass="nav-item"and beforeaction="/logout"; nostyle="and noonclick=appear. -
The D5 spec: 18 page tests, plus the drawer, table and desktop tests.
Docs: design-system.adoc §3.8, a Reflow bullet covers the 900 px menu, the table regions, the responsive project, and D7’s list of unasserted surfaces. CHANGELOG: the #560 entry is extended with the menu and the spec.
Risks
-
No JavaScript, below 900 px. fail-closed: the nav panel stays hidden. Accepted, because tabs and panels already need htmx; every page stays reachable by URL.
-
A browser without
:has()(Firefox before 121, Safari before 15.4). fail-open: the hiding rule never applies, so the panel shows expanded in the page flow and stays usable. -
Always-focusable table regions add a Tab stop per table at every width. silent cost to keyboard users. Mitigation: each stop has a label; a tabindex only when a table overflows is #3043.
-
Surfaces, roles and data the spec does not load. silent: an overflow there is clipped by
.main-content. Mitigation: D7 lists them, and #3044 extends the spec. -
A pack edit pushes a semantic pair below 4.5:1. fail-closed for shipped packs: U1’s unit test fails. silent for a pack kept outside the repository. design-system.adoc states the floor.
-
The journey’s theme flip leaks into later steps. fail-closed: the restore runs right after the audit, and a later screenshot would show dark.
-
Battery time. About +70 s (D8). silent: the e2e lane slows without failing. Mitigation: the 90 s shrink rule, and the timing table of the first battery records the measured cost.
Verification
-
cargo xtask test: the unit and integration lanes pass (see Testing). -
cargo xtask dev reload(no schema change), thencargo xtask e2e. -
Mutation checks, each made and then reverted: delete
.u-badge-warning(the TANF test fails on the computed colour); unwrap one table (every_template_table_sits_in_a_table_scrollnames the file); delete the 900 px block (the responsive spec fails on the hidden-panel and overflow checks). -
Manual check at 320 px in devtools, as
jane.caseworker: dashboard, then a case, then file an appeal (#560’s walkthrough). Screenshots of the menu closed and open in light and dark, and of/noticeswith the table scrolled. -
cargo xtask validate, withCANOPY_CARGO_FEATURES=canopy-api/test-clock,canopy-api/test-fault. -
Close: U3 sets Status to
Done (YYYY-MM-DD) — !N, moves this plan and its nav entry underplans/archive/, and passescargo xtask plan-lint --done.
Documentation Updates
-
Orchard Design System: §3.1 status badges (U1), §3.7
table_scroll(U2), §3.8 Reflow (U3). -
CHANGELOG.adoc== Unreleased=== Fixed: #3039 (U1) and #560 (U2, extended in U3).Unreleasedholds more than one release’s worth; the cut is #3016’s, not this plan’s. -
No
api/canopy-web.adoc,data-models/or Service Catalog change: no route, table or event changes.
Review log
| round | vendor | resolved model | verdict |
|---|---|---|---|
1 |
Anthropic |
claude-fable-5-1 |
FLAGS (2): the battery-time risk named no failure mode; U1 used a contrast helper that does not exist and the plan did not say to add it. Both fixed in the draft. |
2 |
gemini-4-argon |
FLAGS (2): the same risk label; the five templates missing the import were not named, |