Skip to content

draft editor: writing-surface polish pass#84

Merged
jorgefilipecosta merged 6 commits intotrunkfrom
draft-editor-writing-surface
May 6, 2026
Merged

draft editor: writing-surface polish pass#84
jorgefilipecosta merged 6 commits intotrunkfrom
draft-editor-writing-surface

Conversation

@jorgefilipecosta
Copy link
Copy Markdown
Member

@jorgefilipecosta jorgefilipecosta commented May 6, 2026

Polish pass on the draft editor to make it read like a deliberate writing app rather than a chat surface with a CodeMirror dropped in.

Typography

  • Title was inheriting body 13px and computing to 26px (2em), so the document title rendered smaller than the H1 inside the editor (34px). Switched to an absolute 36px so it sits one notch above body H1.
  • CodeMirror's baseTheme sets line-height: 1.4 on .cm-content directly, which beats the 1.7 we had on .cm-editor via deeper specificity. Re-asserted 1.65 on .cm-line itself — that's the only place that survives the override.
  • Heading scale retuned (H1 1.85em, H2 1.4em, H3 1.18em, H4 1.05em) with more breathing above each. H4 was indistinguishable from body before; H1/H2 ran a touch wide.
  • Writing column max-width tightened 760 → 720, side padding 8 → 32 for breathing on the column edges.

Quieter titlebar chrome

  • Back button: ← Project → square 28px icon-only with aria-label="Back to project". Matches the visual register of undo/redo and the action menu instead of standing apart as a labelled button.
  • Action-menu trigger fades to opacity 0.7 by default and lifts to 1 on hover or when the menu is open.
  • Save-status indicator: when "saved", drops to a bullet-only dot — writers don't need confirmation-on-success, the absence of "Saving…" / "Unsaved" is itself the all-clear. "Unsaved changes" tightened to "Unsaved" to match. Word-count chip drops to 11.5px.

Slash menu / toolbar housekeeping

  • Divider moved out of the toolbar into the / commands menu next to image/quote/h1–h4 — block insertion is in one place now and the toolbar regains a slot of horizontal room.
  • Toolbar separator margins 4px → 2px so the toolbar packs tighter even with the chip alongside.

Toolbar/word-count overlap on narrow titlebars

When both side panels are open and a selection is active, the formatting toolbar could run wider than the available titlebar room and paint over the word-count chip. A @container query on .main-top-draft-editor (container-name: draft-titlebar) hides the chip in selection mode only when the titlebar's content-box drops below 600px — the empirical width sweep where the toolbar's last button starts touching the chip's left edge. Document-mode chip ("92 words · ~1 min") is never hidden; that's the reading-progress signal worth preserving.

The 600px threshold was tuned by sweeping titlebar widths and recording clearance:

content-box clearance
608px 6px
603px 2px
600px touching

So the chip stays visible all the way down to actual collision rather than firing at a generous guess.

Test plan

  • Lint (eslint + stylelint) clean
  • Unit tests (162) pass
  • tests/e2e/draft-editor.spec.ts (back-button assertion updated for icon label)
  • tests/e2e/draft-slash-menu.spec.ts (new divider action covered)
  • tests/e2e/formatting-toolbar.spec.ts (HR removal, all tests still pass)
  • Live verify in dev: title visibly larger than body H1, line-height 1.65 applied, container query hides chip at 588px content-box and shows it at 603px+

…height

Title-input was inheriting body 13px and computing to 26px (2em), which
made it visually smaller than the editor's own H1 (34px) — the document
title was outranked by its own headings. Switched to an absolute 36px so
the title reads as the largest thing on the page.

CodeMirror's baseTheme sets line-height: 1.4 directly on .cm-content,
which beats the 1.7 we had on .cm-editor via deeper specificity. Set
1.65 on .cm-line itself so it actually applies to body prose.

Heading scale tuned (H1 1.85em, H2 1.4em, H3 1.18em, H4 1.05em) with
more breathing above each — the previous scale ran wide on H1/H2 and
left H4 indistinguishable from body.
The titlebar competes with the page on a writing surface, so dim every
non-action element a notch. Back button drops to 12px / weight 500 with a
muted opacity that lifts on hover; the action-menu trigger fades to 0.7
default and lifts when hovered or the menu is open.

Save status switches to a bullet-only indicator when "saved" — writers
don't need confirmation-on-success, the absence of "Saving…" / "Unsaved"
is itself the all-clear. The dot keeps a visual anchor in the slot so
the row doesn't visibly empty out. "Unsaved changes" tightened to
"Unsaved" to match the same compactness; word-count chip drops to 11.5px
with a touch more letterspacing.
Drops the trailing "Project" label so the back control matches the
visual register of the other titlebar icon buttons (undo/redo, action
menu) — square 28px footprint, 16px arrow glyph. Adds aria-label and
title so screen readers and the hover tooltip still convey "Back to
project".
The button text is now just `←` and conveys "Back to project" via
aria-label. Asserting both keeps the spec honest about what's visible
(the glyph) and what's announced (the accessible name).
Removes the horizontal-rule button from the formatting toolbar and adds
a Divider entry to the / commands menu — block insertion lives in the
same place as the other one-shot block actions (image, quote, h1-4),
and the toolbar regains a slot of horizontal room.

The toolbar can still run wider than the available titlebar space when
both side panels are open and a selection is active, painting the
formatting buttons over the word-count chip. A `@container` query on
.main-top-draft-editor (container-name: draft-titlebar) hides the chip
in selection mode only when the titlebar drops below 720px — wide
viewports keep both visible. Document-mode chip ("92 words · ~1 min")
is never hidden; that's the reading-progress signal worth preserving.

Tightens the toolbar separator margins from 4px to 2px so even when
the chip is shown alongside, the toolbar has more breathing room.
Width sweep showed the prior 720px guard was hiding the chip far earlier
than necessary. Empirically the toolbar's last button reaches the chip
only at content-box widths around 600px — keeping the threshold above
that just clipped the chip on plenty of viewports where it would have
fit fine.

Pinned to 600px (content-box, the value @container measures): chip
stays visible at 603px (2px clearance) and hides only when the buttons
actually touch the chip. Container query measures content-box, not
border-box, so the number's a chunk smaller than the perceived viewport
edge but corresponds to the real collision point.
@jorgefilipecosta jorgefilipecosta marked this pull request as ready for review May 6, 2026 13:37
@jorgefilipecosta jorgefilipecosta merged commit 641fa65 into trunk May 6, 2026
@jorgefilipecosta jorgefilipecosta deleted the draft-editor-writing-surface branch May 6, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant