oficina / docs Public

Docs: the toolbar's pickers open usably on phones

On phones the Style, Font and Size pickers opened as lists about 10 px
tall: rastrillo's select.js clamped a list to boxes that don't clip it.
Rastrillo is pinned to 05478795 (merged as rastrillo f892f8b, #136),
whose placement follows CSS's containing-block and clipping rules, and
the toolbar marks estilo's sticky title bar as the list's ceiling, so a
list that would open upward under it opens downward. A test scrolls every
option of every picker into view at 320, 390 and 1280 px, with and
without an on-screen keyboard, in Chromium and WebKit. Reviewed by
GPT-6-Astra (#95, rastrillo #136).

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

Prompts:

  Fix a bug Fable found while reviewing docs #91. On phones the Docs toolbar pickers are unusable: Style, Font and Size all open to a list about 10 px tall at 390 px wide. This happens on main.
  
  **Root cause, from Fable's analysis.** The bug is in rastrillo's `ui` select.js, in `place()`.
  - `place()` clamps the list to any ancestor whose computed `overflow-y` is auto, scroll, hidden or clip.
  - Docs' phone rule sets `overflow-x: auto` on `[docs-toolbar]`, so its `overflow-y` computes to `auto`.
  - "Room below" therefore comes out as 122 − 120 − 4 < 0, and the list gets `maxBlockSize: 0px`.
  - The list is fixed or anchored, so the toolbar doesn't actually clip it. select.js just can't tell.
  
  There are two possible fixes:
  1. In Docs, use rastrillo's `rst:select-viewport` (`told`) escape hatch.
  2. Fix rastrillo's `place()` so it ignores ancestors that can't clip a fixed or anchored list. That means ancestors that don't establish its containing block. It may also mean treating overflow on one axis correctly.
  
  Prefer option 2 if it's sound, because every app using `ui` pickers inside a horizontally scrolling bar has the same bug. If you change rastrillo, do it on its own branch with a discussion. Then use that branch in Docs, pinned to the branch commit, and say so.
  
  Also fix two related P2s from the same review:
  - At 320 px the font list ends 6 px past the viewport. Use `position-try-fallbacks: flip-inline` or a `max-inline-size` cap.
  - In Firefox without anchor positioning, the widened desktop list (up to 157 px) may add horizontal overflow to a wrapped 320 px bar. Check it with Playwright Firefox if it launches.
  
  And one note from the same review: comments and the test claim the font Twin "stays for DOCX export and paste". Nothing reads `Twin` any more, apart from a test at `export_test.go:810`. Either drop the field or correct the wording. DOCX goes through `docx.name`.
  
  **Repos:**
  - /Users/paulcampbell/amadan.net/oficina/docs (hub oficina/docs), now at main ce485a5.
  - /Users/paulcampbell/amadan.net/rastrillo/rastrillo (hub rastrillo/rastrillo). Read its AGENTS.md: it uses an ordinary merge, no squash, and needs `make mirror-check`.
  
  **Tests, written to fail first:**
  - At 320, 390 and 1280 px, every toolbar picker opens to show at least its first 5 options, stays inside the viewport, and can be scrolled.
  - Use Docs' browser rig through the production stack, in Chromium and WebKit.
  
  **Rules:**
  - Work in worktrees cut from a fresh origin/main. Use branch `fix/phone-pickers` in docs and `fix/select-place-clip` in rastrillo.
  - Use GOTOOLCHAIN=go1.26.5. In docs, run `TMPDIR=/tmp .amadan/ci.d/10-gate` with OrbStack. Run the browser tests with `RASTRILLO_CHROME` set to Playwright's chromium and `-timeout 40m`. The machine is loaded, so re-run any timing failure on its own.
  - End commit messages with `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`.
  - Push as the agent account: `export AMADAN_HOME=$HOME/.amadan-claude-agent`, binary /Users/paulcampbell/.local/bin/amadan.
  - Open discussions and wait for hub CI.
  - Do NOT merge or deploy.
  
  **Report** the branches, head SHAs, discussions and CI status.

Squashed from fix/phone-pickers into main.
claude agent, operated by paul@keymail.dev d867db1ac222ba03ade25cf6e1f5a69eb5f1031c parent 3ef4ef3
13 files changed, +245 −43
  • fixtures/engines/pickers.mjs +162 −0
  • fixtures/toolbar.mjs +10 −0
  • go.mod +3 −1
  • go.sum +4 −16
  • internal/docs/colophon.json +5 −1
  • internal/docs/export.go +3 −2
  • internal/docs/export_test.go +3 −11
  • internal/docs/fonts_engines_browser_test.go +5 −0
  • internal/docs/render.go +4 −0
  • internal/docs/static/{editor.c37b32c458da3201.js => editor.9c2691e6994b6853.js} +11 −11
  • internal/docs/toolbar_engines_browser_test.go +19 −0
  • internal/docs/views/show.html +14 −0
  • internal/fonts/fonts.go +2 −1

CI passed — run details

landed from fix/phone-pickers

fixtures/engines/pickers.mjs

Loading diff…

fixtures/toolbar.mjs

Loading diff…

go.mod

Loading diff…

go.sum

Loading diff…

internal/docs/colophon.json

Loading diff…

internal/docs/export.go

Loading diff…

internal/docs/export_test.go

Loading diff…

internal/docs/fonts_engines_browser_test.go

Loading diff…

internal/docs/render.go

Loading diff…

internal/docs/static/{editor.c37b32c458da3201.js => editor.9c2691e6994b6853.js}

Loading diff…

internal/docs/toolbar_engines_browser_test.go

Loading diff…

internal/docs/views/show.html

Loading diff…

internal/fonts/fonts.go

Loading diff…