Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/HANDOFF.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 8 additions & 3 deletions src/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ async function SignedIn({ children }: { children: ReactNode }) {
export default function AppLayout({ children }: { children: ReactNode }) {
return (
<>
<a href="#content" className="skip-link">
Skip to content
</a>
{/* Two rows on the landing page's night band: the wordmark, Capital
One sync and the account above; the page tabs below. */}
<header className={styles.top}>
Expand All @@ -74,9 +77,11 @@ export default function AppLayout({ children }: { children: ReactNode }) {
<AppNav counts={NAV_COUNTS} />
</Suspense>
</header>
<Suspense fallback={<p className={styles.loading}>Loading…</p>}>
<SignedIn>{children}</SignedIn>
</Suspense>
<div id="content">
<Suspense fallback={<p className={styles.loading}>Loading…</p>}>
<SignedIn>{children}</SignedIn>
</Suspense>
</div>
</>
);
}
65 changes: 58 additions & 7 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/features/cashflow/ui/agenda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export function Agenda({
{item.unconfirmed && (
<span className="cell-card"> · not confirmed</span>
)}
{item.recurringId && cancelPlans.has(item.recurringId) && (
<span className="cell-card"> · planning to cancel</span>
)}
</span>
<span
className={
Expand Down
4 changes: 3 additions & 1 deletion src/features/cashflow/ui/balance-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export function BalanceLine({
>
<span
className={
x(selectedIndex) > 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"
}
Expand Down
62 changes: 62 additions & 0 deletions src/features/cashflow/ui/month-grid.test.ts
Original file line number Diff line number Diff line change
@@ -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> = {}): 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$/);
});
});
15 changes: 11 additions & 4 deletions src/features/cashflow/ui/month-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ const KEY_STEPS: Record<string, number> = {
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<string>) {
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)}`,
Expand Down Expand Up @@ -85,7 +92,7 @@ function Cell({
<button
type="button"
className="cell"
aria-label={describe(day)}
aria-label={describeDay(day, cancelPlans)}
aria-pressed={selected}
// One tab stop for the whole grid; arrow keys move between days.
tabIndex={selected ? 0 : -1}
Expand Down
48 changes: 48 additions & 0 deletions tests/e2e/calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
"true",
);
await expect(cell(page, today)).not.toContainText("Coffee beans");
// Days with nothing of that kind step back with a softer number, not a
// fade that would drop it to about 2:1.
const quietDay = page
.locator(".cell[data-quiet]:not([data-today]) .cell-day")
.first();
await expect(quietDay).toHaveCSS("opacity", "1");
await show.getByRole("button", { name: "Everything" }).click();
await expect(cell(page, today)).toContainText("Coffee beans");

Expand Down Expand Up @@ -349,6 +355,10 @@
subscriptions.getByRole("button", { name: "Planning to cancel" }),
).toBeVisible();
await expect(subscriptions.locator(".saving")).toContainText("$191.88");
// The calendar shows the plan as a strikethrough; the words are there too.
await expect(
page.locator('button.cell[aria-label*="stream service"]').first(),
).toHaveAttribute("aria-label", /stream service [^,]* planning to cancel/);

Check failure on line 361 in tests/e2e/calendar.spec.ts

View workflow job for this annotation

GitHub Actions / e2e

[chromium] › tests/e2e/calendar.spec.ts:317:5 › confirmed paydays and subscriptions fill the headline and the subscriptions list

1) [chromium] › tests/e2e/calendar.spec.ts:317:5 › confirmed paydays and subscriptions fill the headline and the subscriptions list Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toHaveAttribute(expected) failed Locator: locator('button.cell[aria-label*="stream service"]').first() Expected pattern: /stream service [^,]* planning to cancel/ Timeout: 5000ms Error: element(s) not found Call log: - Expect "toHaveAttribute" locator('button.cell[aria-label*="stream service"]').first() with timeout 5000ms - waiting for locator('button.cell[aria-label*="stream service"]').first() 359 | await expect( 360 | page.locator('button.cell[aria-label*="stream service"]').first(), > 361 | ).toHaveAttribute("aria-label", /stream service [^,]* planning to cancel/); | ^ 362 | 363 | // The choice is saved where Recurring payments reads it. 364 | await page.goto("/subscriptions"); at /home/runner/work/Reeflect/Reeflect/tests/e2e/calendar.spec.ts:361:5

Check failure on line 361 in tests/e2e/calendar.spec.ts

View workflow job for this annotation

GitHub Actions / e2e

[chromium] › tests/e2e/calendar.spec.ts:317:5 › confirmed paydays and subscriptions fill the headline and the subscriptions list

1) [chromium] › tests/e2e/calendar.spec.ts:317:5 › confirmed paydays and subscriptions fill the headline and the subscriptions list Error: expect(locator).toHaveAttribute(expected) failed Locator: locator('button.cell[aria-label*="stream service"]').first() Expected pattern: /stream service [^,]* planning to cancel/ Timeout: 5000ms Error: element(s) not found Call log: - Expect "toHaveAttribute" locator('button.cell[aria-label*="stream service"]').first() with timeout 5000ms - waiting for locator('button.cell[aria-label*="stream service"]').first() 359 | await expect( 360 | page.locator('button.cell[aria-label*="stream service"]').first(), > 361 | ).toHaveAttribute("aria-label", /stream service [^,]* planning to cancel/); | ^ 362 | 363 | // The choice is saved where Recurring payments reads it. 364 | await page.goto("/subscriptions"); at /home/runner/work/Reeflect/Reeflect/tests/e2e/calendar.spec.ts:361:5

// The choice is saved where Recurring payments reads it.
await page.goto("/subscriptions");
Expand Down Expand Up @@ -555,3 +565,41 @@
expect(reply).toContain(`That leaves ${perDay} a day until then.`);
expect(reply).toContain("14 days away");
});

test("fits a 360px phone with a five-digit balance, and the day panel stays below the header on desktop", async ({
browser,
baseURL,
}) => {
const page = await newUserPage(browser, baseURL);
await addAccount(page, { nickname: "Everyday", balance: "12345.67" });

await page.setViewportSize({ width: 360, height: 800 });
await openDashboard(page);
await expect(page.locator(".sums")).toContainText("$12,345.67");
// The last day of the month puts the balance label at the right edge.
await page.locator("button[data-date]").last().click();
expect(
await page.evaluate(
() => document.documentElement.scrollWidth <= window.innerWidth,
),
).toBe(true);
for (const figure of await page.locator(".sums dd").all()) {
const box = (await figure.boundingBox())!;
expect(box.x + box.width).toBeLessThanOrEqual(360);
}

await page.setViewportSize({ width: 1440, height: 700 });
await page.mouse.wheel(0, 800);
await expect
.poll(() =>
page.evaluate(() => {
const header = document.querySelector("header")!;
const panel = document.querySelector(".panel")!;
return (
panel.getBoundingClientRect().top >=
header.getBoundingClientRect().bottom
);
}),
)
.toBe(true);

Check failure on line 604 in tests/e2e/calendar.spec.ts

View workflow job for this annotation

GitHub Actions / e2e

[chromium] › tests/e2e/calendar.spec.ts:569:5 › fits a 360px phone with a five-digit balance

2) [chromium] › tests/e2e/calendar.spec.ts:569:5 › fits a 360px phone with a five-digit balance, and the day panel stays below the header on desktop Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toBe(expected) // Object.is equality Expected: true Received: false Call Log: - Timeout 5000ms exceeded while waiting on the predicate 602 | }), 603 | ) > 604 | .toBe(true); | ^ 605 | }); 606 | at /home/runner/work/Reeflect/Reeflect/tests/e2e/calendar.spec.ts:604:6

Check failure on line 604 in tests/e2e/calendar.spec.ts

View workflow job for this annotation

GitHub Actions / e2e

[chromium] › tests/e2e/calendar.spec.ts:569:5 › fits a 360px phone with a five-digit balance

2) [chromium] › tests/e2e/calendar.spec.ts:569:5 › fits a 360px phone with a five-digit balance, and the day panel stays below the header on desktop Error: expect(received).toBe(expected) // Object.is equality Expected: true Received: false Call Log: - Timeout 5000ms exceeded while waiting on the predicate 602 | }), 603 | ) > 604 | .toBe(true); | ^ 605 | }); 606 | at /home/runner/work/Reeflect/Reeflect/tests/e2e/calendar.spec.ts:604:6
});
23 changes: 23 additions & 0 deletions tests/e2e/skip-link.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { expect, test } from "@playwright/test";
import { SIGNED_IN_STATE } from "./support";

test.use({ storageState: SIGNED_IN_STATE });

test("the first Tab offers to skip the header and lands in the page", async ({
page,
}) => {
await page.goto("/accounts");
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Accounts");

await page.keyboard.press("Tab");
const skip = page.getByRole("link", { name: "Skip to content" });
await expect(skip).toBeFocused();
await expect(skip).toBeInViewport();

await page.keyboard.press("Enter");
await page.keyboard.press("Tab");
// Focus moved past the header's wordmark, Sync, Sign out and page tabs.
expect(
await page.evaluate(() => !!document.activeElement?.closest("#content")),
).toBe(true);
});
Loading