Skip to content

Fold a playground's instruction into one bar with a popover - #4274

Merged
max-sixty merged 10 commits into
mainfrom
playground-compact-send
Oct 26, 2026
Merged

max-sixty merged 10 commits into
mainfrom
playground-compact-send

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A playground's instruction pane drew the whole prompt at rest under an "Instruction to agent" title, with worded Reset and submit buttons in a footer, so a long instruction took more of the playground than the controls that wrote it. The pane is now one bar: Reset as the retry symbol (as a live sample's Reset is), a more (⋯) button that opens the instruction, and the one worded action, the submission. At 1440×900 the notification workspace's pane goes from about 210px to 58px.

The ⋯ button opens the instruction in a popover at the middle of the window, so reading it changes no layout and nothing the user set or pressed moves. The popover holds the instruction's title, the text (which scrolls when long) and Leaf's copy control. A second press, Escape, or a click elsewhere closes it and leaves focus on ⋯; Tab goes from ⋯ to Copy. A change in the window's width closes it rather than reflowing it; a height-only change, as a phone's toolbars move, keeps it. The submitted instruction still reaches the agent's thread.

Rejected designs:

  • Unfolding the instruction inside the pane, below the bar in a flowing page and above it at a held workspace's foot. Reviews kept finding the bar moving under the pointer wherever the window was short, after a resize, or with the stage at its floor.
  • A popover anchored to the bar. The bar can stand in a sticky rail, and Firefox draws an anchored box at a stuck target's unstuck position (notes/browser-support.md).
  • Hover, which gives touch no route.

Other changes:

  • The icon table moves from browser/runtime/icons.js into browser/runtime/icon-paths.js, a module with no imports, so a package's first-paint producer draws Leaf's symbols. It replaces motion-icon-paths.js; icons.js keeps the Lit template.
  • widget-api.js exports copyControl, Leaf's one copy control, for a copy among a widget's own controls; module-reading.md documents it beside copyBlock. A code block's copy (copyBlock) hides while its block is away and came back a frame after the popover opened in Firefox, after a Tab had passed it.
  • Copying an instruction keeps the space before a decimal such as .32.
  • The playground author instructions say the user reads the instruction only on request, so what they need to decide goes in the preview or the controls.

Behavior changes in tests:

  • New: test_a_playground_opens_its_instruction_over_the_page.
  • test_inline_playground_keeps_half_a_short_workspace_for_its_stage: the bar stays in view under the half-window stage, and a long instruction scrolls in its popover (the workspace no longer scrolls to it).
  • test_a_short_workspace_shows_more_below_its_playground_regions takes its scrolling controls from the notification playground, since the code comparison's now fit beside the one-row bar.
  • The notification layout test reads the bar as the instruction region's body and drops the title-voice check; there is no title.
  • The note test is renamed for the actions pane it measures.
  • The journeys that copy the instruction open it first; the preset journey reaches Copy by Tab from ⋯.

leaf-dev stills gains playground-instruction (the popover open) and playground-inline-end (the motion playground's bar under its stage).

Tests: the playground cases in tests/browser/widgets/test_playgrounds.py, the three playground journeys in tests/journeys/test_render_widgets.py, the playground cases in the widget, readiness, on-panel, widget-quality and focus suites, pnpm run test:runtime, node build/browser/build.mjs --check. Probes in Chromium and Firefox at desktop and 390×844 touch, light and dark, on the four bundled playgrounds; five Codex review rounds and a fresh-user test, the last round with no functional findings.

Relation to #3898: that draft moves an inline playground's instruction into a sticky rail a quarter of the stage's width so Send stays in view. With the pane down to one row, the rail would hold a single bar, so the width it costs buys less. The two branches conflict in packages/playground/widgets.css.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 10 commits October 25, 2026 14:54
The instruction pane drew the whole prompt at rest under an "Instruction to
agent" title, with worded Reset and submit buttons in a footer. A long
instruction took more of the playground than the controls that wrote it.

The pane is now one bar: Reset as the `retry` symbol (as a live sample's
Reset is), a fold control (`unfold`/`fold`, as a diff's), and the worded
submit button. The instruction stays folded until the user unfolds it, and
brings the code block's copy control with it. It unfolds below the bar in a
flowing page and above it where the pane stands at the bottom of a held
workspace, so the bar and the control just pressed stay where they were.

The first-paint producer now draws icons, so the icon table moves from
icons.js into icon-paths.js, a module with no imports that initial scripts
compile in; it replaces motion-icon-paths.js, and icons.js keeps the Lit
template.

Behavior changes in tests:

- New: `test_a_playground_unfolds_its_instruction_without_moving_its_actions`
  (workspace and column).
- The notification layout test reads the instruction pane's body and drops
  the check that its title matched the presets' voice; there is no title.
- The short-workspace cue test unfolds the instruction in a 500px window to
  make the controls scroll, since the folded bar now leaves them room at
  540px.
- The journeys that copy the instruction unfold it first; Tab reaches the
  copy from the submit button rather than Shift+Tab from Reset.

`leaf-dev stills` gains `playground-instruction` (unfolded, under the
pointer) and `playground-inline-end` (the motion playground's bar under its
stage).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
In a held workspace the pane's body scrolls and is a container, so a copy on
the pane's top border was clipped, and at the rule's end it covered the
submit button's key badge.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Two reviews of the folded instruction:

- In a held workspace whose stage was at its floor, unfolding pushed the bar
  down by the instruction's height, since the workspace scrolled to it. The
  instruction pane's row now takes what is left after the stage's or the
  controls' floor (`minmax(0, max-content)`), and the unfolded instruction
  scrolls inside it, so the bar stays where the user pressed it. This
  replaces the instruction-keeps-its-whole-height rule; the stage still keeps
  half the window, as decided on 2026-10-22.
- The copy, seated on the rule like a code block's, showed only under a
  hovering pointer, stood far from the fold control and came after the submit
  button in Tab order while drawn above it. It is now a quiet action at the
  bar's start, shown while the instruction is unfolded, with a finger's
  floor; appearing there, it moves none of the other controls.
- Copying an instruction no longer drops the space before a decimal such as
  `.32`: the whitespace rule strips spaces only before punctuation that ends
  a word.

Behavior changes in tests: the short-workspace inline test now asserts the
bar stays put and the instruction body scrolls, where it asserted the
workspace scrolled; the preset journey reaches Copy by Shift+Tab from Reset.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A second review found the CSS rows that let the instruction shrink to the
room left (`minmax(0, max-content)`) also let a crowded workspace squeeze the
whole bar to 0px, and that the copy appearing could wrap the bar and move
the fold control.

The full-height rows are main's again. Which side the instruction unfolds on
is measured instead of keyed on the layout: it unfolds below the bar, and if
that moved the bar, above it (the same pane draws the bar an instruction's
height lower there). Where the stage's floor leaves less room above than the
instruction needs but room for four lines, the instruction takes that room
and scrolls in it. Only a window too short for that leaves the bar moving,
on the side that moves it less, with `placeKeeper` holding its place in the
pane's scroller as far as it can scroll. The copy keeps its room while
hidden, so its arrival neither moves nor wraps the bar.

Behavior change in tests: the short-workspace inline test checks at 900x700
that the bar stays and the instruction scrolls in the room above it, and at
900x500, where no room is left, that the workspace scrolls to the whole
instruction and its actions, as on main.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Three reviews of the instruction unfolding in its pane kept finding the bar
moving: below the bar in a flowing page and above it at a held workspace's
foot was right only while the window had room, and a resize or a stage at
its floor moved the bar again. Each fix added a case.

The reveal (Leaf's `more` symbol) now opens the instruction in a popover at
the middle of the window, so reading it changes no layout in any Layout:
nothing the user set or pressed moves, and resizing has nothing to keep. The
popover carries the instruction's title and the code block's copy; a long
instruction scrolls inside it. A second press or Escape closes it and leaves
the user on the reveal, and Tab goes on from the reveal to Copy. It stands
at the window's middle rather than anchored to the bar, since the bar can
stand in a sticky rail, where Firefox draws an anchored box at the target's
unstuck place (notes/browser-support.md).

The measuring, `placeKeeper` and `data-unfolds` code is gone, and the
full-height rows are main's.

Behavior changes in tests: the unfold test becomes
`test_a_playground_opens_its_instruction_over_the_page`; the short-workspace
inline test checks the stage keeps half the window with the bar in view and
the long instruction scrolls in the popover; the cue test takes its scrolling
controls from the notification playground, since the code comparison's now
fit beside the one-row bar; the preset journey reaches Copy by Tab from the
reveal.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A fourth review found the popover's copy, a code block's (`copyBlock`),
hidden for a frame or more after the popover opened in Firefox, since a
block control draws only while its block renders; a Tab in that time
reached Submit instead. A popover's head is no block of source text, so the
copy is now `copyControl`, Leaf's one copy control, which `widget-api.js`
exports to bundled packages for a copy in a widget's own toolbar.

The reveal's press-closes rule now applies only to a pointer's click, so a
press dragged off the reveal no longer swallows the next Enter. A window
changing width puts the popover away, rather than reflowing it, which also
ended a ResizeObserver loop in Web Awesome's copy icon when the window
narrowed with the popover open (the preset journey, one run in three; main
is clean); height alone, as a phone's toolbars move, keeps it. Comments in
the full-height rules now name the bar where they named the instruction.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/runtime/icons.js
#	dist/kernel/kernel.json
# Conflicts:
#	browser/runtime/icons.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-errors.js
#	dist/kernel/runtime/widget-api.js
#	packages/playground/widgets/lf-playground.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/widget-api.js
@max-sixty
max-sixty merged commit 300bd56 into main Oct 26, 2026
4 checks passed
@max-sixty
max-sixty deleted the playground-compact-send branch October 26, 2026 17:44
max-sixty added a commit that referenced this pull request Oct 26, 2026
…l overflow

Main's #4274 moved this test's controls case to the notification
playground at 1100x700. On this branch the controls carry no Controls or
Starting points label, so the list fits at 700px and nothing scrolls;
at 600 it runs past the rail's foot as the test needs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 27, 2026
test_notification_playground_sets_regions_side_by_side_while_its_workspace_is_full_height
read the controls region at 1100x700 and needs it to overflow, so it can
scroll the list under its fixed presets. Main's #4274 folded the instruction
into one bar, which hands the rail's height to the controls, and this branch
removed the Controls and Starting points labels over them (baf1d30,
ce28d05). Each alone leaves the list overflowing at 700px; together, merged
in df3af2a, it fits (clientHeight and scrollHeight both 449), so nothing
scrolls. The regions still scroll on their own; the test now reads them at
1100x600, where the list runs past the rail's foot, as ebadac6 did for the
short-workspace cue test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 31, 2026
The published-page journey inferred pane scrollers from direct children,
so the footer-only instruction bar introduced by #4274 made
code-comparison call `getComputedStyle(undefined)`. The journey now
reads Leaf's registered visible reading regions and their effective
scrollers through the diagnostic API. It requires a nonempty set of
regions, scrollers inside the workspace with automatic overflow, and a
document that does not scroll. A nested region may use its containing
region's scroller, as the compact instruction bar intentionally does.

This preserves #4274's compact bar and popover and retains the complete
live published-page sweep. The existing synchronous check-API wait
resolves the module before polling the predicate.

Validation: `uv run pytest
tests/journeys/test_site.py::test_every_published_page_stands_as_a_live_page
-xq -n0` reproduced the reported failure on the unchanged test and
passes with this change (1 passed). A focused Chromium probe on
code-comparison passes normally and rejects a control with its scrollers
disabled. Ruff lint/format, Python compilation and `git diff --check`
also pass.

Closes #4827 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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.

2 participants