oficina / docs Public

Docs I2: stacked header, floating inspector, share popover (phase 2) closed

On branch design/i2

Phase 2 of the Docs UI pass: the I2 layout Paul chose, built to spec docs/superpowers/specs/2026-11-11-editor-i2-design.md (revision 2.1, reviewed on #105). Phase 1 (design/richer-ui) is merged as 61c24eb and live on edge as v0.1.0-77-g61c24eb.

Paul's go-ahead (2026-11-11): "Yeah, get it all done and ship it when it's ready".

Done on this branch so far

  • d67f4c0: Share is a popover under its button. - The server-rendered panel comes from GET /d/{sqid}/share?panel=1, but only for a script's request; a typed or reloaded URL still gets the page. - Every panel form carries panel=1, so its 303 comes back to the panel. - The one-time link appears in the panel the publisher sees, with no-store. - brand/share-pop.js sends forms with fetch, allows one request at a time, and shows a spinner after 500ms. - On desks it is a manual popover; on phones, a modal sheet. - Go tests, plus a Chromium and WebKit engines check covering desk and phone.

To come

  • An estilo bar-stack branch (built separately): the stacked header slots, the controls set, a WideOnly toggle, title sizing, Appearance switched in place, and the shim re-vendor.
  • In Docs: - the header undo/redo pair outside roving; - the Format toggle with the docs-inspector cookie; - the inspector at 64rem and up, with C2 visibility filtering; - sheet centring; - the inspector's light and back-lit hover.

I2, the Docs half: built. The tip is 0d2e8f8, and CI passed there (amadan ci status exits 0). Ready for Claude Fable's whole-branch review. Nothing is merged or deployed.

estilo: pinned to main 39792ae (bar-stack merged; the tree is identical to 3953755). go mod tidy is clean. TestColophonsMatchWhatShips passes; x/text was already listed.

What was built, against the spec

  • Stacked header (P2, C1). - The editor passes Bar.Menubar (its menu bar) and Bar.Lead (the undo/redo pair). Both come from views/partials/editor_bar.html, through a new renderer.fragment. - The actions are Format (a WideOnly toggle with Controls: "docs-inspector" and the pencil icon), then the import report when there is one, then Share (Primary). - Every other page keeps the one-row bar.
  • One menu bar (revision 2.2, added to the spec). [docs-chrome] no longer draws its own menu row. Below 800px, estilo's second row is the menu bar. There is exactly one <nav estilo-menubar> in the page.
  • Undo/redo (P1.2, C6). - docs-history is drawn twice: in the lead slot from 800px, and in the strip below 800px, as a role="group" outside [docs-toolbar]. CSS shows exactly one. - toolbar.mjs takes a history option. It binds both pairs and keeps them in sync, and the undo-manager stack listeners refresh both. Neither pair is in setupRoving. - Both pairs and Format joined setInert's set.
  • Inspector (64rem and up). - The same [docs-toolbar], inside <aside docs-inspector id="docs-inspector" rst-box data-state aria-label>. - Geometry: 248px wide, at calc(var(--estilo-bar-block-size) + 12px) and 12px from the inline end, with 12px radius, glass, 12px padding and sections 14px apart. - Sections: Style (the style picker, then font beside a 64px size), and Text, Alignment and Lists as joined 28px segmented rows. - Each section is a role="group", aria-labelledby its visible 11px/650 label. The labels are catalog keys. - Light: rastrillo's card light. The lit value is reshaped to max(0, lit*1.43-0.43), the rim and wash use the mock-up's values (far fainter in dark), and controls get the back-lit hover. All of it is under (hover: hover), with no transitions under reduced motion. Coarse pointers get 32px. - The inspector is hidden in print.
  • Format and its cookie. - docs-inspector is open unless it is exactly closed (inspectorState, a closed comparison like viewMode). - The server renders the state onto the aside and into Expanded. - brand/inspector.js (a plain deferred script, under the CSP) enables the button, toggles it in place, keeps aria-expanded current and writes the cookie (Path=/, a year, SameSite=Lax, and Secure on https). - Closed hides the inspector only from 64rem (C3).
  • Sheet centring. The rule is padding-inline-end: clamp(16px, 16px + 816px + 2R - 100%, R), with R = 276. 100% is the canvas's containing block, so it is not 100vw. With the inspector closed, the sheet is plainly centred.

Tests (each new one seen to fail for the right reason)

  • Go (i2_test.go): - The editor's bar is sticky stacked, with the Menubar and Lead slots; there is one menu bar and one File menu; the pair is out of the toolbar with no tabindex; the index's bar is unchanged. - Format and the aside are rendered from the cookie in six cases. - The sections are named groups, and there is one toolbar. - TestTheOwnerGetsAShareControlInTheBar now checks the order lead → Format → Share (primary) → account. - TestToolbarOptionValuesMatchTheBundle also reads the partial. - Mutations: an empty Menubar, a cookie that is ignored, a dropped role="group", Share not primary, and a bogus command in the partial.
  • Node (toolbar.test.mjs): both pairs are synced and never given a roving tabindex. Mutations: pairs in roving; pairs not bound.
  • Engines (fixtures/engines/i2.mjs and TestEnginesTheI2Layout, Chromium and WebKit): - The header is 56px and the stack starts at 56px; the pill, Format, Share and the avatar are 28px. - The inspector at 1280, the strip at 1000 (open and closed, C3) and the phone at 390. - Format toggles without navigating, sets aria-expanded and the cookie, and the next page is rendered closed. - Closed, Tab goes from the account straight into the document and Escape stays there (C2). Open again, Tab reaches the toolbar. - The header's pair stays current through keyboard undo and redo, and agrees with the strip's. - The sheet is centred at 1800 and 1440, and ends at W−276 at 1280. - No sideways scroll at 320. - Mutations: C3 broken, centring removed, pair unbound, and a row-wrap bug at 390px. That last one was real: it was caught by a new check and fixed (flex-basis: 0).
  • Moved to the bar's pair: richer.mjs (which also holds the two pairs to each other) and browser-drive.mjs (whose tab count is now barStops + 2). The font wait's inWait/waitLog inert checks cover both pairs and Format; mutation: they were dropped from setInert.
  • Results: go test ./... -count=1 is green. The full -tags browser ./internal/docs/ suite is green (1178s). Node is 193/193.

Deviations

  1. The sheet-centring padding is capped at R. From 1108px up it is exactly the spec's formula. Below that, the uncapped formula shrinks the sheet beyond the room it has (648px at 1024px instead of 732px). With the cap, the sheet fills the space beside the panel. - It uses a padding percentage, not a container unit. container-type would make <main> the fixed inspector's containing block.
  2. The roving order is now the reading order (selects, then buttons). It used to be buttons then selects, which only made sense while undo/redo came first.
  3. Undo/redo no longer get an aria-pressed. sync used to write aria-pressed="false" onto them, so they announced as toggles. It now writes aria-pressed only where the server rendered it.
  4. The inspector hides the hover tooltips, as the mock-up does. The section labels give the context, and a tooltip would cover the next row.
  5. Readers get the lead pair and Format too. The toolbar was always rendered for them, inert.
  6. The font notes stop short of the open inspector (inset-inline-end: 272px), so their dismiss button is never under it.
  7. first-reveal.mjs's capture clip was hard-coded for the old layout (x 225, y 200). It now comes from the sheet's own box, and the sheet's left edge is compared per frame. Mutation: a script that opened the inspector 400ms after load was caught.

Open

  • scripts/browser-drive.sh hangs on this machine at its first CDP Page.navigate (the sign-in link), before any check runs. That is environmental and unrelated to this branch. Its edits (the bar's pair, barStops + 2) are therefore unverified by a run.
  • Nothing is needed from estilo.

Correction to the reply above: the Node tests are 192/192, not 193.

Reviewed by Claude Fable (claude-fable-5-2): whole-branch review of design/i2 at 0d2e8f8, from a review-only worktree.

Verdict: APPROVED WITH CHANGES

No P1. The share panel's security holds: owner-only access, the right fragment rules, the one-time URL exactly once with no-store, CSRF and escaping. The undo/redo pair is correct, and the first-reveal check was not weakened (its mutations were caught).

P2

  1. A failed first load leaves a blank popover stuck at "busy". This happens with an expired session or a lost network: there is no message and no close button. When nothing has been drawn yet, close the popover and go to the share page instead. Add an engines leg.
  2. Pickers fall to 13px on coarse pointers from 64rem (show.html:1465), and iOS zooms at that size. Restate max(1rem, 1em) in the coarse block and add a wide coarse leg to the zoom test.
  3. Two behaviours have no test that can fail. The C2 drawn() filter needs a node test with checkVisibility() === false. The popover's in-flight guard, switch revert and 500ms aria-busy need a delayed or aborted POST leg.

P3

  • Sec-Fetch-Dest is a deny-list. Make it dest == "empty" and test the iframe and frame cases.
  • The inspector is clipped on short viewports. Add a max-block-size with overflow.
  • The pressed state vanishes in forced colours. Add Highlight outlines. The popover buttons and select need a transparent border.
  • The lead buttons are 30×28 on coarse pointers. Make them 32px.
  • Escape with the inspector closed leads nowhere. Focus Format instead.
  • The roving order change is untested.
  • Readers get a dead inspector, which was a dead dock in phase 1. This is Paul's call.

Deviations: all judged sound, including the 276px cap, padding as a percentage, roving in reading order, and dropping aria-pressed from undo/redo.

Mutations: 23 run, 3 survived (the order swap, drawn(), and busy). Hub CI passed at 0d2e8f8.

Review fixes, all on design/i2. The tip is aeb9c0a; CI passed (exit 0). go test ./... -count=1 is green, Node is 197/197, and the full -tags browser ./internal/docs/ suite is green (1294s). Every new check was seen to fail for the right reason. Not merged.

  • P2.1 (37e6b8b): if the first panel load fails, the popover closes and Share goes to location.assign(href). failed() stays for redraws. share-pop.mjs adds two legs: a refused panel GET lands on the share page, and cleared cookies land on sign-in. Red with the old catch.
  • P2.2 (3eb7e51): max(1rem, 1em) is restated for the inspector's pickers under coarse pointers. TestNoZoomOnTap adds a 1280px touch leg that checks the inspector is fixed. It was red at 13px.
  • P2.3a (943babe): new toolbar-roving.test.mjs, added to the gate, with four cases. With checkVisibility() === false the control never takes the stop. With nothing drawn, focusStop() is false and nothing is focused. A stop whose control stops being drawn moves to one that is. The arrows skip hidden controls. All four go red without drawn().
  • P2.3b (37e6b8b, e089a24): - A held POST: a second switch is refused and goes back, and exactly one request is sent. - aria-busy is absent at 250ms and present at 650ms, timed from the request; the first version raced a slow click and flaked. - An aborted POST reverts its switch and shows the error. - Red with the guard removed, with no busy, and with busy at once.
  • P3 Sec-Fetch-Dest (a5191f2): the check is now dest == "empty". iframe, frame, embed and object were added to the test, which was red on the old check.
  • P3 short viewports (a5c82f0, aeb9c0a): - With anchor positioning: max-block-size: calc(100dvh - var(--estilo-bar-block-size) - 24px) and overflow-y: auto. - The pickers' lists were absolute at 64rem, not anchored, and would have been clipped. They are now fixed and anchored as the phone strip's are. - The glass blur moved to a ::before, because a backdrop-filter makes the panel the containing block of fixed descendants. - Without anchor support the panel keeps its height and clips nothing. - i2.mjs adds a 300px-tall leg, red without the max-block-size, with absolute lists, and with the blur back on the panel. Checked in both engines.
  • P3 forced colours (e089a24): pressed [docs-tool] buttons get outline: 2px solid Highlight. Invite, Copy and the access select get border: 1px solid transparent with box-sizing: border-box, so their size is unchanged. Checked under emulated forced colours; red without either rule.
  • P3 coarse lead buttons (3eb7e51): 32×32 in a 32px pill (its padding drops). Measured in the zoom test's wide leg, which was red at 30×28.
  • P3 Escape when the inspector is closed (42ce957): toolbar.focusStop() || focusFormat(), and focusFormat() acts only when Format is drawn, enabled and not inert. i2.mjs expects Format; red with the old binding.
  • P3 roving order (943babe): toolbar.test walks from Home and expects the pickers, then the buttons. Red with the order swapped. Starting the walk at the first picker could not see a swap, because the arrows wrap.
  • P3 readers (ac1393c): for !CanWrite there is no strip or inspector, no Format, no undo/redo pair in either place, and no inspector.js. They keep the stacked bar's menus. Their sheet is plainly centred, because the centring rule keys on an open inspector. TestAReaderGetsNoFormattingChrome was red before. Nothing was entangled. This reverses my deviation 5.

Reviewed by Claude Fable (claude-fable-5-2): delta review of design/i2 0d2e8f8..aeb9c0a.

Verdict: CHANGES REQUIRED (one P2)

P2: the share-pop.js first-load fallback navigates in two cases where it must not:

  • Offline: in Chromium the editor is replaced by an error page, and words typed offline are lost.
  • Dismissed: after Escape during the load, a later failure still navigates.

Fix: navigate only when a response came back without a panel and the popover is still open. On a rejected fetch, close and stay. Add a leg for each case.

P3

  • The submit-level busy guard is untested (a double Invite).
  • i2.mjs leg 8 is not guarded by g.anchors.

Confirmed fixed

  • Pickers are fixed and anchored, and stay usable at 300px.
  • Without anchor positioning they still pass.
  • The reader, writer and guest pages, and the /p/ page, are correct.
  • Escape now goes to Format.
  • The CI gate change is correct.
  • The P3s are fixed.

16 mutations, 15 killed. CI is green at aeb9c0a.

Delta fixes, on design/i2. The tip is 89b94f1; CI passed (exit 0). go test ./... -count=1 is green, Node is 197/197, and the share-pop and i2 engines tests pass, as do TestFontTheFirstRevealIsTheFinalLayout and TestFontEnginesFirstRevealIsTheFinalLayout. Every new check was seen to fail. Not merged.

  • P2 (fallback navigates): - A failed first load now closes the popover. - Share goes to the share page only when the server answered with something that is not the panel (sign-in or 404), and only while this opening is still the open one. A generation counter and isOpen() decide that. - A fetch that got no answer stays on the document. - A load for a closed or reopened popover draws nothing. - share-pop.mjs now has five first-load legs: a 404 goes to the share page; offline, with words typed, stays and keeps the words; an aborted request stays; Escape then a 404 stays, closed; an expired session goes to sign-in. - Red on the old fallback in both engines, including chrome-error:// and the lost words in Chromium. Also red with the open check dropped, and with the answered check dropped. - No offline message: nothing in the page carries the copy without a panel, so it was not cheap. The popover closes and the page stays.
  • P3 (busy): two presses of Invite while the first is held send one request. Red with busy || dropped (2 requests in both engines). The busy leg's route now also holds and counts /d/x/share; it used to miss the invite.
  • P3 (i2.mjs:259): leg 8's list check is guarded by g.anchors too.

Reviewed by Claude Fable (claude-fable-5-2): delta review of design/i2 aeb9c0a..89b94f1.

Verdict: APPROVED

The P2 is fixed. Share navigates only when a response arrived without a panel while the same popover is still open. A network failure closes the popover and stays. A late success draws nothing stale. Both earlier P3s are closed: the double-Invite leg is real, and both list checks are guarded by g.anchors.

One new P3, not blocking: the reopen and stale-draw guards (share-pop.js:119 and :178) are correct by reading, but no test can fail on them. A slow load, Escape, reopen leg would cover both.

Five mutations run: three killed, two survived (the P3). Node tests 197/197, no bundle diff. The share-popover and I2 engine checks pass, and CI passed at 89b94f1.

Merged as faad78a and deployed to edge as v0.1.0-78-gfaad78a. docs.oficina.works and lagged.docs.oficina.works both report it on /api/version. The full Chromium/WebKit suite was green at 89b94f1 before the merge. The one remaining P3, a test for the share-pop reopen and stale guards, is a follow-up.