oficina / docs Public

Click the paper, get a caret — and no focus ring around it

Two things made the editor read as a text box sitting on a page
rather than as the page itself.

A click anywhere but on the prose did nothing. The editable node was
only ever as tall as its own text, so the page's 1in margin and the
empty space below the last line belonged to [docs-page] — not to
anything editable — and a click there landed on nothing. [docs-page]
is now a flex column with the editor as a grown child (flex: 1 0
auto), which hands the empty space below the last paragraph to
ProseMirror's own handling; the margins, which the editable node can
never reach into, are covered by placeCaretFromPage in
fixtures/editor-entry.js: it clamps the click's coordinates into the
editable node's rectangle and asks posAtCoords, so "beside the text"
resolves to the nearest end of the nearest line.

And the browser drew its default focus ring around the focused
contenteditable — a blue box tracing the text area of a sheet of
paper. [docs-editor]:focus now takes outline: none. That costs no
accessibility here and only here: the caret is a stronger,
always-visible focus indicator than the ring it replaces, which is
not true of the buttons and links in the chrome around it, and those
keep rastrillo's own focus styling untouched.

Verified in Chromium against ./scripts/run-dev.sh, signed in for
real: a click in the left margin puts the caret at offset 0 of the
block level with it; a click below the last line, and one in the
bottom margin, put it at the end of the last block; typing lands
there; and getComputedStyle reports outline-style none on the
focused editor. go test ./internal/... ./cmd/... and node --test
fixtures/*.test.mjs both pass. Bundle rebuilt (fixtures/
build-editor.mjs) — editor.2c8c082596237a4c.js.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017F61AU8zx7FcpF1zEPvMpp
Paul Campbell pushed by paul@keymail.dev 3aaf231b60368f0274c7182717c5c2ccf2aefe87 parent 855f95b
3 files changed, +101 −12
  • fixtures/editor-entry.js +56 −1
  • internal/docs/static/{editor.15280b7eedd1868f.js => editor.2c8c082596237a4c.js} +11 −11
  • internal/docs/views/show.html +34 −0

CI passed — run details

Intent

Attributed to this commit: 81.9 g CO₂e (7506372 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on worktree-click-to-place-caret, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

fixtures/editor-entry.js

Loading diff…

internal/docs/static/{editor.15280b7eedd1868f.js => editor.2c8c082596237a4c.js}

Loading diff…

internal/docs/views/show.html

Loading diff…