diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 1898b12..dedd721 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -4587,3 +4587,49 @@ rows", transactions 2 "show more" in steps of 20, plus a view-only list. ### Open problems - Not checked visually in a browser in this session. + +## HO-124: Accessibility fixes from the UI audit: calendar, header, phones + +- **Date:** 2026-10-11 (UTC) +- **Author:** Muhammad Tahub Khatri with Claude Code +- **Branch / PR:** `fix/ui-a11y` / PR linked from the branch + +### What changed +- **Quiet days:** with a filter on, days with nothing of that kind faded + to opacity 0.35, which dropped their numbers to about 2:1 on buttons + that still work. They now keep full opacity with `--ink-soft` and a + lighter weight (7:1 or better). +- **Planning to cancel:** a subscription the person plans to cancel was + only a strikethrough. The day cell's label (`describeDay`, now exported + from `month-grid.tsx`) and the list view both say "planning to cancel" + (ADR-042: every visual state has words). +- **Day panel:** it stuck at `top: 1rem`, under the sticky header. New + `--header-h` token (7rem): the panel sticks below the header, is never + taller than the window and scrolls inside itself. `scroll-padding-top` + uses the same token. +- **Phones:** the three sums sat in three 100px columns and a five-digit + balance overlapped the next one at 360px; at 40rem and below each sum is + a row. The balance line's label opens to the left past the middle (was + 70%), so it no longer runs off a narrow screen. +- **Skip link:** "Skip to content" is the first Tab stop on every + signed-in page and jumps past the header's dozen controls. +- **Links:** links without a class took the browser's default blue (fails + contrast on the dark ground). They now take the text colour around them. +- Tests: `month-grid.test.ts` (Vitest) for `describeDay`; + `calendar.spec.ts` checks quiet days, the cancel label, 360px and the + panel under the header; `skip-link.spec.ts` for the skip link. + +### Verified +- `pnpm lint`, `typecheck`, `format:check`, `docs:check` and `build` + pass. `pnpm test:unit`: everything passes except the Neon storage tests, + which need `storage-tests` credentials this container does not have + (TEST-05). +- Playwright was not run (Muhammad runs it). + +### What's next +- The day panel's × still removes an entry at once; confirmations are in + `fix/ui-confirmations`. + +### Open problems +- `--header-h` is an estimate of the header's height, not measured. If the + header grows (a third row), raise it. diff --git a/src/app/(app)/layout.tsx b/src/app/(app)/layout.tsx index 1975666..7381e69 100644 --- a/src/app/(app)/layout.tsx +++ b/src/app/(app)/layout.tsx @@ -48,6 +48,9 @@ async function SignedIn({ children }: { children: ReactNode }) { export default function AppLayout({ children }: { children: ReactNode }) { return ( <> + + Skip to content + {/* Two rows on the landing page's night band: the wordmark, Capital One sync and the account above; the page tabs below. */}
@@ -74,9 +77,11 @@ export default function AppLayout({ children }: { children: ReactNode }) {
- Loading…

}> - {children} -
+
+ Loading…

}> + {children} +
+
); } diff --git a/src/app/globals.css b/src/app/globals.css index 955e699..19acf91 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -38,6 +38,10 @@ is the header's night band, grid and all, so the two read as one. */ --page-grid: transparent; + /* About the height of the sticky signed-in header (src/app/(app)/ + layout.tsx), so nothing sticky or scrolled-to hides under it. */ + --header-h: 7rem; + /* Figures that should line up like a statement. */ --font-num: var(--font-mono), ui-monospace, Menlo, monospace; @@ -149,12 +153,38 @@ html { font-size: clamp(16px, 11px + 0.42vw, 20px); /* Room for the sticky header (src/app/(app)/layout.tsx), so a focused or linked-to element is never hidden underneath it. */ - scroll-padding-top: 8rem; + scroll-padding-top: calc(var(--header-h) + 1rem); } /* The grid is fixed to the window, like the sticky header's and the dashboard hero's, so its lines run on unbroken from the header into the page while it scrolls. */ +/* Links without a class of their own take the colour of the text around + them, never the browser's default blue (which fails contrast on the dark + ground). */ +a { + color: inherit; + text-underline-offset: 0.15em; +} + +/* "Skip to content": the first stop for the keyboard, shown only when + focused (src/app/(app)/layout.tsx). */ +.skip-link { + position: absolute; + top: -10rem; + left: 1rem; + z-index: 20; + padding: 0.5rem 1rem; + border-radius: 8px; + background: var(--head-ink); + color: var(--head-bg); + font-weight: 600; +} + +.skip-link:focus { + top: 1rem; +} + body { background-color: var(--bg); background-image: @@ -711,9 +741,11 @@ button.cell:hover, } } -/* A day with nothing of the chosen kind steps back */ -.cell[data-quiet] > * { - opacity: 0.35; +/* A day with nothing of the chosen kind steps back: softer, lighter + number, still readable (fading it with opacity fell to about 2:1). */ +.cell[data-quiet]:not([data-today]) .cell-day { + color: var(--ink-soft); + font-weight: 400; } .cell { @@ -768,7 +800,11 @@ button.cell:hover, .panel { position: sticky; - top: 1rem; + /* Below the sticky header, and never taller than the window. */ + top: calc(var(--header-h) + 1rem); + max-height: calc(100dvh - var(--header-h) - 2rem); + overflow-y: auto; + overscroll-behavior: contain; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-card); @@ -1213,16 +1249,31 @@ footer { .panel { position: static; + max-height: none; + overflow: visible; } } /* Phones: cells show marks and bars; names live in the day panel */ @media (max-width: 40rem) { + /* One sum per row, label left and figure right: three columns were + too narrow for a five-digit balance at 360px. */ .sums { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - gap: 0.75rem; + grid-template-columns: minmax(0, 1fr); + gap: 0.5rem; + } + + .sums > div:not(.sums-op) { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 1rem; + } + + .sums dt { + max-width: none; } .sums-op { diff --git a/src/features/cashflow/ui/agenda.tsx b/src/features/cashflow/ui/agenda.tsx index 9c073b9..e84d37c 100644 --- a/src/features/cashflow/ui/agenda.tsx +++ b/src/features/cashflow/ui/agenda.tsx @@ -64,6 +64,9 @@ export function Agenda({ {item.unconfirmed && ( · not confirmed )} + {item.recurringId && cancelPlans.has(item.recurringId) && ( + · planning to cancel + )} 70 + // Past the middle, the label opens to the left so it never + // runs off a narrow screen. + x(selectedIndex) > 50 ? "line-label line-label-left" : "line-label" } diff --git a/src/features/cashflow/ui/month-grid.test.ts b/src/features/cashflow/ui/month-grid.test.ts new file mode 100644 index 0000000..8089411 --- /dev/null +++ b/src/features/cashflow/ui/month-grid.test.ts @@ -0,0 +1,62 @@ +import { describe, expect, it } from "vitest"; +import { cents } from "@/lib/money"; +import type { DayView, Item } from "../domain/cashflow"; +import { describeDay } from "./month-grid"; + +function item(overrides: Partial = {}): Item { + return { + id: "item-1", + date: "2026-02-10", + name: "StreamFlix", + amount: cents(-1599), + kind: "subscription", + category: "Subscriptions", + planned: false, + recurringId: "rec-1", + ...overrides, + }; +} + +function day(items: Item[]): DayView { + return { + date: "2026-02-10", + day: 10, + isToday: false, + isFuture: false, + items, + moneyIn: cents(0), + moneyOut: cents(1599), + everydaySpent: cents(0), + endBalance: cents(120000), + noSpend: false, + }; +} + +describe("describeDay", () => { + it("says in words that a subscription is planned to be cancelled", () => { + const label = describeDay(day([item()]), new Set(["rec-1"])); + + expect(label).toContain("StreamFlix"); + expect(label).toContain("planning to cancel"); + }); + + it("says nothing about cancelling when no plan matches the item", () => { + expect(describeDay(day([item()]), new Set(["rec-2"]))).not.toContain( + "cancel", + ); + expect( + describeDay(day([item({ recurringId: undefined })]), new Set(["rec-1"])), + ).not.toContain("cancel"); + }); + + it("keeps the other states and the balance", () => { + const label = describeDay( + day([item({ onCard: true, unconfirmed: true })]), + new Set(), + ); + + expect(label).toContain("on card"); + expect(label).toContain("planned, not confirmed"); + expect(label).toMatch(/balance \$1,200\.00$/); + }); +}); diff --git a/src/features/cashflow/ui/month-grid.tsx b/src/features/cashflow/ui/month-grid.tsx index 3f1b2fa..ca57e98 100644 --- a/src/features/cashflow/ui/month-grid.tsx +++ b/src/features/cashflow/ui/month-grid.tsx @@ -42,13 +42,20 @@ const KEY_STEPS: Record = { ArrowDown: 7, }; -function describe(day: DayView) { +/** + * What a day cell says to a screen reader. Every visual state has words + * here (ADR-042): on card, planned and not confirmed, planning to cancel + * (the cell shows that one only as a strikethrough). + */ +export function describeDay(day: DayView, cancelPlans: ReadonlySet) { const parts = [formatLong(day.date)]; if (day.isToday) parts.push("today"); - for (const item of day.items) + for (const item of day.items) { + const cancelling = !!item.recurringId && cancelPlans.has(item.recurringId); parts.push( - `${item.name} ${formatSigned(item.amount)}${item.onCard ? " on card" : ""}${item.unconfirmed ? " planned, not confirmed" : ""}`, + `${item.name} ${formatSigned(item.amount)}${item.onCard ? " on card" : ""}${item.unconfirmed ? " planned, not confirmed" : ""}${cancelling ? " planning to cancel" : ""}`, ); + } if (day.noSpend) parts.push("no-spend day"); parts.push( `${day.isFuture ? "expected balance" : "balance"} ${formatCents(day.endBalance)}`, @@ -85,7 +92,7 @@ function Cell({