Skip to content

Studio: UI consistency — one Esc per layer, focus that comes back, errors that say so, and one button system (#1035) - #1043

Merged
danielrispler merged 21 commits into
mainfrom
issue-1035-ui-consistency
Dec 2, 2026
Merged

danielrispler merged 21 commits into
mainfrom
issue-1035-ui-consistency

Conversation

@danielrispler

@danielrispler danielrispler commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Closes #1035
Closes #1037
Closes #1038
Closes #1039
Closes #1040
Closes #1041
Closes #1042

Summary

One pass over the page's shared behaviour and primitives (spec #1035), in six tickets plus the final review's fixes.

 Dismiss (Esc, a rebound key, or the palette)
+  an open hint → closes alone (spec #582, kept)
+  an open auto popover (⋯ menus, plate menu, draft drawers) → hides it, stops
+  an inline box (Change…, Ask, Why-not) → handles its own Esc: collapse, keep the draft, refocus its button
   the map's layers, in today's order
+    a nested layer (replay, scrub, badge list, popover) before the focused layer that holds it
+    otherwise the layer holding focus first, only while the keyboard is in use
ui/
├── overlay-focus.ts   # new: opener, focus-on-keyboard-open, refocus on close, keepFocusIn across a redraw of the same subject
├── dom.ts             # closeButton (quiet ×, "Close", hint ends "(Esc)") and statusLine (loading / empty / error + Try again, role=alert)
├── toast.ts           # error toast for failed map writes Daniel made; stays until dismissed
├── map-agents.ts      # badge list rows keyed and patched; CSS-anchored, re-anchored after each paint
├── tokens.css         # --conflict → --failed, --float, --z-* in layer order, six type sizes
└── style.css          # .btn base / link / quiet / primary / primary.light, one disabled look, .field, .tag, one focus ring

Departures from the spec (all keep the user stories)

  1. Sheet and drawer still rebuild on a redraw, and keepFocusIn refocuses the matching control (by key/name, then position) when the same subject redraws. Keyed patching would have kept nodes whose handlers close over the old draw (~30 handlers in 8 modules).
  2. Esc prefers the focused layer only while the keyboard is in use: Chrome focuses a clicked button, and the literal rule broke ten existing fixtures (mapPrPanelPlaying, mapBriefWhyEsc, …).
  3. The left panel and the PR brief give focus back on close but don't take it on open (stories 15/17 don't list them; it would break ↑/↓ in the list).
  4. The badge list anchors to the part's chip row, not the badge button: hovering a row swaps the badge for that session's chip, and the list must stay put (mapSpotlight). Snap checks it sits under the badge within 1 px.
  5. "Ask about this" error lines stay muted: not in the spec's list of reds.
  6. For Daniel: a drawer opened from the brief now sits over it (--z-drawer), undimmed; the two overlap on a ~1200 px map (S5 below).

Evidence

  • Screenshots for review (story 47), in local-evidence/2026-12-01-ui-consistency-audit/screenshots/: 1037-mapPreFlightPick.png (Pre-flight primary), 1037-mapBackLaw.png (patch review primary), 1037-mapDraftAccept.png (Write system-map.json), 1037-mapScan.png (Draft the map, quiet links), 1037-mapBriefStory.png (cream Next), 1037-mapCatchUpCard.png (cream catch-up). Start the run has no fixture that shows it enabled. Drawer over the brief: brief-drawer-before.png / brief-drawer-after.png in the session scratchpad.
  • Before: Esc with the rail's ⋯ open closed the menu, the panel and the selection. After: mapPanelMenuEsc — one Esc closes the menu, a second the panel; Rename refocuses ⋯.
  • New snap fixtures (each red against the base UI first): mapPanelMenuEsc, mapPanelChangeEsc, mapPanelLightDismiss, mapSheetFocus, mapUnread, mapHistoryUnread, writersUnread, writersTestUnrun, listUnread, listUnreadHealed, listEmpty.
  • Node tests: keys.test.mjs (Dismiss hides only the top popover), map.test.mjs (focusedEscapes, pressClosesPanel table), map-zone-hooks.test.mjs (focus kept across a redraw, not onto another subject), map-badge-list.test.mjs (new), writers.test.mjs, plan-view.test.mjs, focus.test.mjs (error toast table), dom.test.mjs (status line), frame.test.mjs greps (one primary rule, z only by token, no spacing radius, no "couldn't"/"plate", ✕ only as the failed mark).
  • npm run check green at the tip (2155 nextest, 1096 node); snap:all green after Studio: red means failed, one glass, ring, field and tag, the type and z scales, and the copy rules #1041 (339 fixtures); Windows runs green after every merge.

Tests merged: map.test.mjs's "a press closes the open panel unless…" became the pressClosesPanel table (every original selector row kept, plus drag and session-badge rows). writers.test.mjs's failed Test / Remove key test became a two-row table. None removed.

Final review

Standards, spec and correctness axes (/code-review high); every finding was checked against the code, all fixed:

  • Correctness: C1 Esc in the panel closed it instead of stopping ▶ replay (nested layer vs focused layer, every pair checked) — fixed a23428bc8. C2 the session list's error line stayed after the stream delivered sessions; C3 "No sessions" while still loading — fixed ae219c974.
  • Spec: quiet/link buttons had no press step (c73120b5c); four empty lines kept a full stop (4ba50b7a2); two hand-built loading lines (a2058c3fa); editor-link folded into link; drawer under the brief (c73120b5c); keepFocusIn lost focus on a renamed control (c29e35543).
  • Standards: one removeKey helper (3ff6fee6c), the error toast's alert line (5952d01c3), --float uses --shadow, Opener.plate → ownerId (425f4058e).

Outside review

gemini-4-neon-medium — cost: 6.2 min, 365333 tokens; Gemini quota left: weekly 76% to 74%, 5h 57% to 50%. None of the three had been reported by the correctness pass.

  • Fixed — a failed Remove key never showed when the writer list's re-read also failed (eee58943e).
  • Fixed — keepFocusIn focused an unrelated button when the sheet switched subject (zone → part, drawer → drawer); now only across a redraw of the same subject (ad622b7a8).
  • Fixed — the panel's light dismiss read the press target at pointerup, so a redraw between press and release closed the panel; now decided at pointerdown (ef21a7143).

Merge Danger

Door: two-way

Front-end only: CSS, ui/ TypeScript, snap fixtures, docs, one law's text and id in system-map.json. No stored or wire type changes.

Blast Radius: page-wide

Every surface's buttons, fields, focus ring and close control change look; Esc and focus behaviour change on every overlay. Risk is a missed hover/press colour (not asserted; check by eye) or a keyboard path the fixtures don't press.

Route outcomes

Medium UI tickets so far in this run: 3 (#1037, #1040, #1041).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CVqACbVDnoZe3YEAyeVFct

danielrispler and others added 20 commits December 1, 2026 21:12
…hovers, one white primary and a cream light one (#1037)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVqACbVDnoZe3YEAyeVFct
…ack, one close button (#1038)

- Dismiss hides an open hint, then the topmost open menu (an auto popover), alone, from any key or the palette; only then do the map's layers peel. An Esc that hid one takes the key whole.
- The Change… box and the Ask box (with its Why-not field) handle their own Esc: collapse, keep the text, focus their button.
- The story panel closes on a click without a drag (the sheet's 4 px), read from pointerdown to pointerup; a press on a session badge keeps it.
- ui/overlay-focus.ts: an overlay opened from the keyboard takes the focus (sheets, drawer, pre-flight, micro-world, patch review); every overlay, the panel and a PR brief included, gives it back to its opener on close when it was inside or lost. While on the keyboard, Esc closes the layer holding the focus first.
- A map redraw keeps the focus on the same control in the sheet, zone sheet and drawer.
- The pre-flight, micro-world and patch review are regions. Rename and Delete from the rail's ⋯ give the focus back to ⋯.
- closeButton (dom.ts): one quiet ×, named Close, hint ending (Esc), for the sheets, drawer, panel, palette, micro-world and the Map draft's drawers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anchored to its badge (#1039)

- The badge list's rows are keyed by session (and subagent) and patched while the same sessions and subagents are listed, so a running step updates their text and keeps their nodes, the hovered row's spotlight and a focused row's focus; a session or subagent joining or leaving draws them afresh.
- The list is placed by CSS anchoring with flip fallbacks: its anchor is its part's chip row, the badge's place, which a paint keeps and a map redraw replaces, so it stays under the badge's new copy after each paint, stays put while a spotlit chip stands in the badge's place, and closes when its part has none. The Map draft's plate menu is anchored to its plate (or frame header) by the same rule. Both JavaScript placers are gone.
- Tests: map-badge-list.test.mjs (rows kept or redrawn per update, the anchor through a paint, a spotlit chip, a map redraw and the badge leaving); mapBadgeList checks the list stays under the badge across paints, mapScanMerge that the plate menu ends at its plate's end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ows a toast (#1040)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…og uses the status line (#1040)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d z scales, and the copy rules (#1041)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1035)

With the focus in the session panel, Esc stopped closing the panel over a
running ▶ replay; likewise the brief's popover, a scrub from the sheet and a
badge's list. A layer with no focus box of its own is never passed over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rive, and No sessions waits for them (#1035)

The stream's sessions now clear the error, a reopen's failed re-read no longer
shows it over a read list, and an empty projects answer no longer shows
No sessions before the sessions are read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1035)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a fold whose count changed (#1035)

keepFocusIn found the control again only by its name and classes, so a fold's
summary whose count the commit changed lost the focus. It now falls back to
the control's place among those of its kind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in editor is a link, a drawer shows over the brief (#1035)

Quiet, row, round-line, session-pick and choice buttons press to --selected
over their --hover; a link presses to the new --bright over its --fg hover.
The editor link takes the link variant instead of its own copy of the states,
and the round links' duplicate hover goes. A drawer closes before a PR brief,
so the side area rises over the brief while it holds one (--z-drawer), and the
brief no longer dims the drawer it opened. --float reuses --shadow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
removeKey left its line to the list's re-read, which draws nothing when it
fails over a list it has; it now draws first. Outside review finding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rawer, never onto another subject (#1035)

keepFocusIn's place fallback put the focus on an unrelated control when a
press showed another subject (a zone's part sheet, another drawer). It now
keeps the focus only while the overlay shows the subject it showed.
Outside review finding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ess, so a redraw before the release keeps it (#1035)

Outside review finding. The part sheet's own light dismiss already decides at
pointerdown (map.ts pan), so it needs no change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danielrispler
danielrispler marked this pull request as ready for review December 1, 2026 21:48
Conflicts where both specs fixed the same places:
- panel.ts: the light dismiss keeps #1035's click-not-drag and reads where the press began from the event's path fixed at dispatch (#1044).
- main.ts: Dismiss stays `dismiss(document, peelLayers)`; peelLayers takes #1047's rule that the list is a layer only while overlaid.
- map-agents.ts: #1039's chip-row anchor and keyed rows, with #1045's openOn focus fallback.
- map-pre-flight.ts: the failed issues read is a status-line error, worded "The open issues could not be read: <reason>" (copy rule).
- index.html: the rename field is a .field with #1036's note.
- fixtures.ts and map.md: both sides kept.
- mapPanelHistory: a hover hint of a control drawn under the resting pointer is not a stranded one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVqACbVDnoZe3YEAyeVFct
@danielrispler
danielrispler merged commit 98e1ea8 into main Dec 2, 2026
12 of 13 checks passed
@danielrispler
danielrispler deleted the issue-1035-ui-consistency branch December 2, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment