Skip to content

Let a playground control stand beside the item it changes - #2711

Merged
max-sixty merged 3 commits into
mainfrom
playground-controls-beside-items
Oct 13, 2026
Merged

max-sixty merged 3 commits into
mainfrom
playground-controls-beside-items

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

In the plain HTML comparison, judges preferred configuration pages that kept each alert's thresholds and route beside its evidence over Leaf pages whose one playground rail held all fourteen settings. Leaf's playground could not do otherwise: its initial producer moved every lf-playground-control into the rail, and page check refused a control anywhere but as the playground's direct child.

A control now stands as close as it can to what it changes, and the author decides where that is. A direct child of lf-playground stands in the rail, as before; a control written inside lf-playground-preview, at any depth, is drawn where it is written, beside the item it changes. Either way it belongs to its playground: its value joins the submitted map, presets and Reset set it, and its name is unique within the playground. A playground whose every control stands in the preview has no Controls pane, or only its presets. A press on a control in the preview takes focus as any control does.

The placement is a kernel registry key, x-within: the regions, each an element declaration, where a member may also stand at any depth; it belongs to the nearest owner around them. lf-playground-control declares ["lf-playground-preview"], so a control inside the instruction, or outside every playground, is refused.

author.md states the rule: a control that changes the whole preview, as most do, stands in the rail; where the preview holds several items that each take their own settings, each item's controls go beside it and only the shared settings stay in the rail. Scored with Claude Code:

  • playground-controls-stand-by-their-item (new; four alerts and a page budget): base 0/2, every control in the rail; candidate 2/2.
  • playground-presets-are-whole-designs gains a guard that controls changing every line of a diff stay in the rail: base 2/2, candidate 2/2.

examples/alert-thresholds.html is the configuration page this makes possible: each alert's replay beside its own threshold and route, sticky totals, and the page budget in the rail. It joins the corpus but not the catalog.

Reviewed by an independent reviewer, whose findings (focus after a press in the preview, controls accepted inside the instruction, registry wording, the empty Controls title, the example's totals) are fixed; focused model and browser tests, the bundle check and the eval-format tests pass.

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

A control that changes the whole preview stays a direct child of
lf-playground and stands in the rail; one written inside
lf-playground-preview, at any depth, is drawn where it is written.
The placement is a kernel registry key, x-within: the regions where a
member may also stand, belonging to the nearest owner around them.
author.md states when controls go beside their items, scored by the new
playground-controls-stand-by-their-item case and a rail guard on
playground-presets-are-whole-designs. examples/alert-thresholds.html
is the configuration page this makes possible.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty enabled auto-merge (squash) October 13, 2026 01:37
leaf-agent
leaf-agent previously approved these changes Oct 13, 2026
# Conflicts:
#	skills/leaf/packages/playground/widgets/lf-playground.js
leaf-agent
leaf-agent previously approved these changes Oct 13, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 6ccd006 into main Oct 13, 2026
3 checks passed
@max-sixty
max-sixty deleted the playground-controls-beside-items branch October 13, 2026 04:21
max-sixty added a commit that referenced this pull request Oct 13, 2026
Records the follow-ups the playground-placement work in #2711 left open,
so they outlast the session that found them: a recommendation's reason
in prose beside the options, the playground rail staying in view beside
a tall preview, multi-block sidebars, the narrow-table and
clipped-control checks across widths, a quoted playground's empty item
boxes, the tally's small gaps, and answering a comment that arrived
before a page changed hands. #20 no longer lists per-item configuration
controls, which landed in #2711.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
With controls beside each item in the preview (#2711), a playground's
stage can run several windows tall, as `alert-thresholds` does. On a
column page the rail beside it, which holds the page-wide controls, the
instruction and the submit button, scrolled away above the stage. At
1024x768 the submit button sat 1,800px above the window once the user
reached the last alert. A workspace playground (#3141) already fits the
window, so only a stage that runs past the window lost its rail.

The rail now sticks as a sidebar page's track block does (#2636),
through the same rule rather than a copy of it. The playground wraps its
controls and instruction panes in one generated box marked
`data-lf-track`, and the Layout's "Sticking blocks" rule now covers a
widget's track as well as a column's margin sidebar and a sidebar page's
track block. The track sticks below the head room, takes at most the
window's height and scrolls what it holds beyond that. The playground
registers the rail as a reading region, since it may scroll.

A sticking block flows with its holder wherever `--lf-track-posture:
flow` holds:

- Where the playground stacks the rail with its stage, below 43.5rem and
on a phone, as a stacked sidebar track flows. The rail then draws no
box.
- Inside a box that scrolls on its own (`[data-lf-scrolls]`) or inside
another sticking block. The block's height is the window's, so inside a
shorter scroller its foot, and the submit button, would be cut off until
the stage ended. A workspace playground's rail flows for this reason
too, since its workspace already bounds it.

Two changes to the shared rule reach the existing sticking blocks as
well:

- Its height now subtracts the top it sticks at, so under a page tab
strip its foot no longer runs behind Leaf's floating row by the strip's
height.
- It declares `--lf-holds-height: 1`, since it holds the window's height
on purpose; the widget quality check named the rail otherwise.

`module-scroll-and-motion.md` states the contract for package authors.

Measured with `leaf-dev probe` on `alert-thresholds`, scrolled to the
middle of the stage:

- 1440x900: base controls top -988, submit -562; now 24 and 450.
- 1024x768: base controls top -1537, submit -1038; now 24 and 523.
- 1024x500: the rail is bounded to 380px, scrolls its 581px, and
focusing the submit button scrolls the rail to show it.
- 1024x500 under a 48px strip: the rail runs 72 to 404, above the
floating row at 428.
- The Ask made a 420px scroller: the rail flows, as on base.
- 390x844: unchanged, with the rail after the stage.

The workspace playgrounds (`data-explorer`, `notification-playground`,
`code-comparison`) keep identical region geometry at 1440x900, 1024x768
and 800x520. A sidebar page's track block and a column page's margin
sidebar still stick at 24px, in Chrome and Firefox. `leaf package check
--render` on the playground package reports no findings. A new `leaf-dev
stills` state, `playground-tall-stage`, shows the rail beside the last
alert where base shows empty space.

Behavior changes in tests: a new test holds the rail and submit button
in the window while the user works the last alert, with the rail flowing
at phone width. It fails without the track rule. The notification
playground's flowing workspace, at 1100x300, now scrolls the controls
and instruction in the rail beside the stage rather than in the page.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
A playground quoted in a static sample hides its controls, those written
beside items in its preview included (#2711), but the box the page wrote
around an item's controls kept its border, padding and height and stood
empty beside the item.

The playground's initial drawing (`initial/lf-playground.js`) now marks,
in a quoted playground only, each preview element that holds nothing but
controls, blank text and other such boxes, at any depth, and `theme.css`
hides it with the controls. A box that also holds words or another
element keeps them. The rule is `!important` because the page's own
stylesheet outranks the package layer and usually sets that box's
display, as `.alert-settings` does; a settled option's collapse uses
`!important` for the same reason. A live playground marks nothing and is
unchanged (the `playground-controls` still is identical).

`tests/fixtures/pages/quoted-playground.html` quotes an alert playground
with a settings box beside each alert: one with a sentence before its
control, one with each control in a field of its own. It joins the
corpus and backs a new `quoted-playground` stills state. The new browser
test fails on the base with the latency box visible.

A page whose grid gives the settings box a fixed track, as
`examples/alert-thresholds.html` does, keeps that track empty when
quoted; Leaf can't know the page's grid, and the fixture's flex row lets
the evidence take the width.

Reviewed by Codex in two rounds: the first, of a pure-CSS `:has()`
version, found that bare text beside a control was hidden with its box
and that a box nesting control wrappers stayed empty; this version fixes
both, and the second round found nothing.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[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