Repository navigation
Count slots beside the Build tab, and keep the count up to date - #1077
Conversation
The Build tab's number added slots and fields together and changed only on a reload. It now counts slots: the layout passes its count to BuildBridge, the Build tab reports its own as slots are added, duplicated or deleted, and the tabs show the reported count until the layout loads again. A screen reader hears "Build 4 slots" in place of the bare number, from a new organizer.build.sheet.slotCount message, translated into Swedish and German. The Build page's budget goes from 151.6 to 151.8 kB for the reporting hook. The e2e label-fit helper skips visually hidden text, which is on no line. Fixes #597. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SUiiX78YRCR84dpJve
Tophat: passedRan 46a373b locally with
Not caused by this PR, but seen along the way:
For the owner (UX): The number beside a signup's Build tab now counts only its slots, and it changes the moment a slot is added, duplicated or deleted, rather than on the next reload. A screen reader hears "Build 4 slots" rather than "Build 7". Shown in Screenshots are in https://claude.ai/code/session_016YZ9SVEQxJF4v3jskEY71c. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
The Build tab's badge now counts slots only, starting from the layout's sig.slots.length and then following the Build tab's useBuildState rows (which are slots, nothing else) through a separate SlotsContext in BuildBridge, so only the tabs re-render when it changes. The derived-state reset (loaded !== slots) means a layout reload (Publish, Close, a Settings save) brings the server's count back, and a tab switch, which keeps the layout's props, keeps the reported one. reportSlots is setShownSlots, so the bridge's memo stays stable. The badge is aria-hidden and the words follow it in sr-only, so the accessible name is "Build 4 slots". TabsNav has one caller, updated. Every item in #597's "Done when" is met, except the comma in "Build, 4 slots", which the description explains (it would mean a hard-coded separator or a message that repeats the tab name). That's a fair trade.
Blocking (0): none.
Optional (2):
src/messages/sv.json/de.jsonslotCount: English writes{count, number, ::group-off}, Swedish and German plain{count, number}, so past 999 slots the spoken count is grouped ("1 000 pass") while the badge shows "1000". Harmless; only matters on very large signups.BuildBridge.tsx~L120: after a reload that follows slots added elsewhere, the badge takes the server's count while the Build sheet still lists its old rows (the tophat saw 10 vs 9). The PR says so and the issue rules out polling, so this is as designed.
Earlier threads: none (Copilot couldn't review: quota).
Checks: CI green on 46a373b (lint-type-test, e2e, CodeQL). Tophat passed on this same SHA, so no runtime change since. Read the diff, the callers of TabsNav, and useBuildState's rows locally.
Waits for the owner because it's UX (the Build tab's number and what a screen reader hears) and it raises a budget: /app/signups/[id]/build 151.6 → 151.8 kB, for the reporting hook and its context. Look at the tophat's 1077-before-* and 1077-after-* screenshots, and 1077-after-tabs-sv-desktop for Swedish.
https://claude.ai/code/session_016YZ9SVW4nwJA8hbYQ1PQ3P
Generated by Claude Code
Owner: Build page size limit raise approvedThe owner approved, in a live session, raising the
This covers the size limit only. The change itself still waits at https://claude.ai/code/session_016YZ9SS7PCSeTVXMcS859ee Generated by Claude Code |
|
Approved by the owner at https://claude.ai/code/session_016YZ9SUe5UE1Mx8NCe1GqEX Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SUe5UE1Mx8NCe1GqEX
Merge: not merged, sent to fixThe PR was in conflict with One gate failed on
The owner's comment above already approves setting this limit to what the page measures with the other PRs in. The fix is likely a one-line https://claude.ai/code/session_016YZ9SUe5UE1Mx8NCe1GqEX Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SUe5UE1Mx8NCe1GqEX
main raised the line to 151.8 kB for #1075's own code, so this PR's raise merged away. With both in, the page loads 151.949 kB (pnpm build && pnpm budgets with CI's NEXT_PUBLIC_* values); budgets are one decimal, so 152. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SUe5UE1Mx8NCe1GqEX
Address: CI fixed in
|
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 2)
Since the last review (46a373b): two merges from main and d90b2b7, which changes only budgets.json: /app/signups/[id]/build 151.8 → 152 kB. No runtime code changed since the tophat that passed (shared check prints 0).
Budget check: my own pnpm build && pnpm budgets with CI's NEXT_PUBLIC_* values measures the Build page at 151.9 kB against 152, so it passes. Budgets use one decimal, so 152 is the smallest limit that fits.
Checks: CI green on d90b2b7 (lint-type-test, e2e, CodeQL). No review threads.
Waits for the owner: it's UX, and the approval recorded at 46a373b doesn't carry over, because d90b2b7 is a commit of the PR's own (the budget raise). The owner's earlier comment approves raising this line to what the page measures with #1075 in, which is what d90b2b7 does, so this needs only a fresh OK. No tophat card (the tophat's screenshots are in its session).
https://claude.ai/code/session_016YZ9SUXdWjAwJhK7qPRd9V
Generated by Claude Code
|
Approved by the owner at https://claude.ai/code/session_016YZ9SVEZdRizJssntdwLA8 Generated by Claude Code |
Resolves the conflict with #1077 in TabsNav: the count badge keeps #1077's aria-hidden on Build (with its sr-only words after it) and this branch's narrower phone spacing. CHANGELOG keeps both entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SSe4RUc89LXkqYHJs6
Fixes #597.
The problem
The number beside a signup's Build tab was
fields + slots, so 4 slots and 3 fields read "Build 7", a number that matches nothing on the page. The layout worked it out on the server, so adding, duplicating or deleting a slot left it as it was until a reload. A screen reader heard "Build 7" with nothing to say what it counts.The fix
sig.slots.length(with its words for a screen reader) toBuildBridgeandTabsNav.BuildBridge(useReportSlotCount, fed fromuseBuildState's rows), andTabsNavreads it withuseSlotCount(). The count sits in a context of its own beside the bridge's, so a change re-renders only what reads it. The bridge lives in the layout, so Responses and Settings keep the new count after the organizer leaves Build. When the layout loads again (Publish, Close, a Settings save), its fresh server count replaces the reported one, since a connected assistant may have added slots meanwhile. No polling, as the issue asks.aria-hidden, and visually hidden text after the tab name gives the count in words, so Chromium's accessible name is "Build 4 slots". The issue suggested "Build, 4 slots". A comma would mean a hard-coded separator in JSX (the hard-coded-text lint forbids it) or a message that repeats the tab's name, so I left it out. Responses keeps its plain number.organizer.build.sheet.slotCount. The server formats the first value, and the Build tab (which already hasorganizer.buildmessages) formats the ones after it. That way the layout still sends the browser no translator. Translated into Swedish ("{count, number} pass") and German ("… Aufgabe/Aufgaben") and marked./app/signups/[id]/buildgoes from 151.6 to 151.8 kB (measured 151.5 kB onmain, 151.8 kB here). It's the reporting hook and the count's context. I cut a first version (151.9 kB) down by replacing a ref-and-layout-effect with state derived from props.measureLabelintests/e2e/helpers/label-fit.tsnow skips text in a 1px box (sr-only). It counted the hidden "44 Aufgaben" as a second line of the tab, failing the 320px fit check in Swedish and German. The check still measures every visible word.Translation review
A different model reviewed the two translations against the glossaries in
docs/translating.md:svorganizer.build.sheet.slotCount: correct (pass is the glossary word and the same in the plural). It suggested the plain form "{count, number} pass" over a plural with two identical branches, asorganizer.aiDraft.titlewrites it. Taken.deorganizer.build.sheet.slotCount: correct (Aufgabe/Aufgaben,{count, number}). No change.Tests
BuildBridge.test.tsx: the count starts from the layout's slots, follows the Build tab as slots come and go, stays on another tab, and gives way to a fresh load's count.TabsNav.test.tsx: Build's accessible name says "2 slots" in place of the bare number, and Responses keeps its number.pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test(3769 passed),pnpm build && pnpm budgets, and the e2e specs for tabs-focus-ring, responses, organizer, translated-organizer, organizer-language, a11y, slot-row-layout and help/* (container config, chromium). CI is green on 46a373b.Before merging
This raises the Build page's number in
budgets.json(151.6 → 151.8 kB), for the reason above.Built in session: https://claude.ai/code/session_016YZ9SUiiX78YRCR84dpJve
🤖 Generated with Claude Code