Skip to content

fix(ui): tighten the composer's constant footprint (#740) - #752

Merged
Astro-Han merged 5 commits into
mainfrom
fix/ui-compact-idle-composer
Jul 12, 2026
Merged

Astro-Han merged 5 commits into
mainfrom
fix/ui-compact-idle-composer

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Tighten the Composer's constant vertical footprint from ~200px to ~164px by statically tightening five levers (textarea min-height, composer/inner padding, inner gap, actions margin-top). No idle/active mode switch — the Composer is the highest-frequency surface at the bottom of the chat column, so an idle↔active height switch would jump the conversation. Stability takes priority. The textarea already auto-resizes to the 240px cap; controls and the workspace/branch row stay mounted.

Also fixes a real 4px chat-boundary jump: streaming swapped the send button (icon-sm/h-8/32px) for a stop button defaulting to md (h-9/36px); stop now uses size="sm" (32px) so the toolbar height is stable across normal/streaming.

Why

An empty composer occupied ~200px — nearly a quarter of an 820px window — before the user typed. Closes #740.

Scope

Static geometry only. Five tightened levers:

  • --h-composer-min 56→44 (textarea min-height, single-line natural)
  • .composer padding 12/16→8/8
  • .maka-composer-inner padding 10/8→8/6, gap 10→6
  • .composerActions margin-top 8→4
    Plus single-source cleanup + stability:
  • removed redundant .maka-composer rest padding (form carries .composer + .maka-composer; .composer is the single padding source)
  • removed redundant Tailwind min-h-11 on the textarea (CSS min-height: var(--h-composer-min) is the single source)
  • removed dead .maka-composer { background } rule (overridden by .composer { background: transparent })
  • stop button size="sm" (h-8/32px) = send icon-sm — no 4px streaming jump
  • workspace/branch row margin NOT tightened (constant mounted control, stability)

No TSX state machine; no transition/reduced-motion special-casing.

Verification

  • RED→GREEN contract composer-constant-footprint-contract: 5 rest levers exactly-once (subject-based matching catches compound alias .maka-composer.composer + selector-list + same-block duplicate) + .maka-composer no-padding form alias + textarea no min-h-* (TSX) + stop button h-8 size. Send height is locked by the existing control-height-converge-contract (.maka-composer-send-button height = --h-control-lg = 32px), not re-asserted here.
  • npm run -w @maka/desktop test — 2344/2344 pass (serial; parallel has pre-existing fs/watch flakiness unrelated to this PR).
  • typecheck + test:checks — pass.
  • CDP on turn-narrative (send) + model-processing (stop): composer 200→164, toolbar 34 both, send 32, stop 32 — no chat-boundary jump across normal/streaming.
  • docs/design-system.md + spacing.stories.tsx synced to 44px / 14px (8 top / 6 bottom).

Impact

Empty composer ~36px shorter (18%); controls, focus ring, attachments, permission/streaming states, workspace/branch row remain usable; streaming no longer jumps the chat boundary 4px. No behavior, API, or migration change. Issue #740 body updated to match (no idle/active mode switch).

Reviewer notes

Chose a static tighten over a stateful [data-compact] + transition (the original AC's "expand only when requires / enters or leaves compact mode" implied a mode switch): the Composer is the highest-frequency surface at the bottom of the chat column, so a mode switch would jump the conversation. The textarea's existing auto-resize already provides content-driven expand; the workspace/branch row stays mounted. The contract intentionally does NOT lock "no state selector ever changes the footprint" via a property blacklist (CSS selectors are unbounded — compound/pseudo/display/border-width); #740's no-mode-switch is upheld by product code (no [data-compact]) + two stability layers (rest levers + send/stop same height), an explicit scope choice. Reviewed through 4 Codex fresh-eye passes; all P0-P2 resolved, final pass clean (1 P3 false-negative fixed).

Ready for review

  • Verification complete and current
  • Impact/compatibility/migration/docs/release-note needs addressed
  • Visual evidence included (CDP computed sizes)

Compact the empty composer from ~200px to ~164px by statically tightening five
constant vertical levers (textarea min-height, composer/inner padding, inner
gap, actions margin-top). No idle/active mode switch — the Composer is the
highest-frequency surface at the bottom of the chat column, so an idle↔active
height change would jump the conversation. The textarea already auto-resizes
with content up to the 240px cap, so content-driven expand is the textarea's
own growth. Controls and the workspace/branch row stay mounted; the workspace
row margin is NOT tightened (stability).

Lock the constant geometry with a CSS-scan contract
(composer-constant-footprint-contract) pinning each lever exactly-once —
catches a later rest block, a selector-list companion, and a same-block
duplicate — plus two lock-against-regression invariants (textarea min-height
follows --h-composer-min; workspace-row margin stays var(--space-2)).

CDP on turn-narrative (820px): composer 200→164, textarea 56→44, inner 128→104,
workspace-row 36 (mt 8, unchanged).
@Astro-Han Astro-Han changed the title fix(ui): compact the idle composer geometry (#740) fix(ui): tighten the composer's constant footprint (#740) Jul 12, 2026
@Astro-Han
Astro-Han force-pushed the fix/ui-compact-idle-composer branch from 50c161f to 80db07f Compare July 12, 2026 07:09
Codex fresh-eye review follow-ups (round 1):

- P2: docs/design-system.md + packages/ui/stories/spacing.stories.tsx still
  listed --h-composer-min as 56px while the token moved to 44px; synced both to
  44px and clarified the doc row as the textarea/input min height (not the
  whole-composer height).
- P3: .maka-composer in maka-tokens.css carried a redundant rest padding
  (var(--space-4) var(--space-6), overridden by .composer in composer.css) and
  the textarea kept a redundant Tailwind min-h-11 (overridden by min-height:
  var(--h-composer-min)). Removed both so composer.css is the single geometry
  source (the contract's exactly-once claim is now true, not cascade-lucky).
- P3: the contract pinned each lever exactly-once but did not lock the core
  #740 invariant — no state selector may change vertical geometry. Added a
  state-geometry guard scanning .composer / .maka-composer / .maka-composer-
  inner state selectors for padding* / gap* / margin* / min-height /
  min-block-size (including longhands), with a negative case proving
  .composer[data-compact] padding-block is caught. Dropped the workspace-row
  margin pin (the row is a constant mounted control; the state guard is the
  stronger, more targeted lock).
…de/DOM alias)

Codex fresh-eye review follow-ups (round 2):

- P2: design-system.md still listed "18px composer vertical padding" after the
  inner padding moved to 8/6 (14px total); synced to 14px and clarified as
  "8px top / 6px bottom" to avoid single-side-vs-total ambiguity.
- P2: the state-geometry guard missed height/block-size/max-*/min-* and a
  local --h-composer-min override — a .composer[data-compact] { height: 120px }
  or { --h-composer-min: 32px } would pass but re-introduce an idle/active
  footprint switch. GEO_PROP_RE now covers height/block-size/max-*/min-*
  (incl. logical longhands padding-block-start/end, margin-block-start/end) and
  --h-composer-min; stateComposerBlocks excludes ::before/::after (streaming
  sweep pseudo-elements, not footprint); the negative case runs end-to-end.
- P3: exactly-once only scanned .composer, but the <form> carries .maka-composer
  + .composer — re-adding .maka-composer padding passed. Now asserts .maka-composer
  declares NO padding (single source for the form's two classes). Also locks the
  textarea className (composer.tsx) against a returned Tailwind min-h-* utility,
  so CSS min-height: var(--h-composer-min) is the single source, not cascade-lucky.
Codex fresh-eye review follow-ups (round 3):

- P2: streaming swapped the send button (size="icon-sm", h-8/32px) for a stop
  button with no size (default md, h-9/36px); the toolbar has no fixed height, so
  the chat boundary jumped 4px on every stream. Stop button now uses size="sm"
  (h-8/32px), matching send. CDP across turn-narrative (send) + model-processing
  (stop): composer 164, toolbar 34 both, send 32, stop 32 — no jump.
- P2: the state-geometry GEO_PROP_RE guard was a fail-open blacklist — compound
  aliases (.maka-composer.composer), pseudo-elements, display/border-width, and
  token overrides all slipped past. Replaced with an honest scope: restBlocks
  matches by DOM SUBJECT (catches .maka-composer.composer compound), and stability
  is locked at two layers — (a) five rest levers exactly-once + .maka-composer
  no-padding form alias, (b) send/stop buttons share h-8/32px so streaming can't
  change the toolbar. No property blacklist; #740's "no mode switch" is upheld by
  product code (no [data-compact]) + these layers, not a dishonest static scan.
- P3: removed the dead .maka-composer { background } rule (overridden by .composer
  { background: transparent }); the "background-only" comment was wrong.
…-height)

Codex fresh-eye review follow-up (round 4, P3):

The send-button size assertion was a false-negative — the regex started at the
attach button (also size="icon-sm"), so changing the real send button to md
still passed. Removed the send assertion entirely (send height is already
locked to 32px by control-height-converge-contract: .maka-composer-send-button
height = --h-control-lg). The stop assertion uses an accurate regex anchored at
the streaming branch (props.streaming ? ( <UiButton ... )), and the negative
case now runs end-to-end through the same extraction — a stop button defaulting
to md (no size) is caught.
@Astro-Han
Astro-Han merged commit 023463e into main Jul 12, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the fix/ui-compact-idle-composer branch July 14, 2026 05:05
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.

fix(ui): compact the composer's constant footprint

1 participant