Skip to content

fix: read no playground field from a control a preview widget generated - #6375

Merged
leaf-agent merged 1 commit into
mainfrom
fix/playground-generated-fields
Nov 18, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/playground-generated-fields

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Since #6231, a playground reads every named input, select and textarea inside it as a field, inside the one <form> it draws around its rail and preview. A widget in the preview that draws named controls of its own then has them read as the page's fields. On motion-playground, lf-motion's transport draws <input name="time"> and <select name="speed">. The playground took both as fields and posted tune {time: 0, speed: "1", timing: …} while nobody touched the page. That event is the at-rest write the nightly render gate reports on motion-playground: data-lf-user-override and childList on lf-playground#panel-motion, and a requestFrame that ran twice. The 403 from /api/event in #6297's local teardown is the same post.

The fix is one more condition in the playground's field membership (playground-view.js). A control inside an element marked data-lf-gen within the playground is no field. offer, offerElement and generatedElement write that mark on everything a widget generates, and passages.js reads it as "not authored". The view's header already said that an inspection setting in a form of its own is no field. A widget's generated controls now count the same way, without each widget having to drop name or wrap its controls in a form. The playground's own wrappers carry no such mark, so the page's fields are unaffected. A control a page script creates without the mark is still a field.

Verification

  • tests/runtime/playground-view.test.mjs adds a generated range and select to its fixture. It fails before this change and passes after it. pnpm run test:runtime passes (1012).
  • test_page_fixture_renders[motion-playground] (--run-nightly, Linux) fails on main with the at-rest findings and passes with this change. A request listener on the served page records no /api/event post at rest after the change, where main posted the tune above.
  • test_page_fixture_renders[playground|alert-thresholds|data-explorer] and five field tests in tests/browser/widgets/test_playgrounds.py still pass.

This leaves part of #6297. The focus-ring finding on motion-playground (test_each_sampled_focus_ring_is_shown_whole_in_its_surface) still fails with this change and has a separate cause, recorded on the issue. The code-comparison and notification-playground layout fixes are in #6373.

Refs #6297 — automated triage

Since #6231 a playground reads every named `input`, `select` and `textarea` inside it as a field, and draws one `<form>` around its rail and preview. A widget in the preview that draws its own named controls then had them read as the page's fields. motion-playground's `lf-motion` transport draws `<input name="time">` and `<select name="speed">`, so the playground took both as fields and posted a `tune` of `{time: 0, speed: "1", timing: …}` with no user input. That event is the at-rest write the nightly render gate reports on motion-playground (`data-lf-user-override` and `childList` on `lf-playground#panel-motion`, a doubled `requestFrame`).

A control inside an element marked `data-lf-gen` within the playground, which `offer`, `offerElement` and `generatedElement` write on everything a widget generates, is now no field, as the view's header already said of an inspection setting in a form of its own. The playground's own wrappers carry no such mark, so the page's fields are unaffected.

The playground-view runtime test now has a generated range and select in its fixture; it fails before this change and passes after it. `test_page_fixture_renders[motion-playground]` fails on main and passes with it.

Refs #6297
@leaf-agent
leaf-agent merged commit 19dffe3 into main Nov 18, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/playground-generated-fields branch November 18, 2026 08:04
leaf-agent added a commit that referenced this pull request Nov 18, 2026
… them into a generated element (#6384)

#6375 made a playground ignore every control inside a `data-lf-gen`
element, so that a preview widget's own generated controls
(`lf-motion`'s `time` and `speed`) stop counting as the page's fields.
It put that test in `member`, which the view also uses to find the
page's own submit and reset buttons and its `<output for>` slots. A page
script that moves its authored submit button into a container it built
with `generatedElement` now loses that button, so Leaf draws its own
rail and action bar beside the page's.
`test_a_page_draws_the_actions_of_a_playground_without_controls` covers
exactly that page, and it failed on main in push run
[44269587200](https://github.com/max-sixty/leaf/actions/runs/44269587200)
with two `.lf-playground-rail, .lf-playground-actions` elements where it
expected none. `output[for]` slots were exposed to the same exclusion,
because the view itself marks each slot with `generatedElement`.

The generated-control exclusion now applies only where the view collects
named `input`/`select`/`textarea` fields. Page buttons and outputs
follow the membership rule they had before #6375. #6375's case is
unchanged: a widget's generated field control is still no field.

Verification:
- `test_a_page_draws_the_actions_of_a_playground_without_controls` fails
on main (the CI run above) and passes on this branch.
- `pnpm run test:runtime` passes (1020), including the generated range
and select fixture #6375 added to
`tests/runtime/playground-view.test.mjs`.
- `test_page_fixture_renders` (`--run-nightly`) for `motion-playground`,
`alert-thresholds`, `data-explorer` and `playground` passes, so
motion-playground still posts nothing at rest.
- 13 field, submit, output, reset and page tests in
`tests/browser/widgets/test_playgrounds.py` pass.

Refs #3985 — 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.

1 participant