Repository navigation
Keep the options a user chose in a select across reloads and revisions - #7426
Merged
Merged
Conversation
A `<select>` on the author's page lost the option the user chose when a reload Leaf asks for brought a fresh document, while a text box's words and a checkbox's tick came back. A live revision that rebuilt the select's options lost the choice too, though the patch kept the select. - `base/document-inputs.js` is now the one home of which state a control carries: `controlState` reads it and `putControlState` writes it, replacing `holdsValue`, `holdsTick` and `holdsOpen`. A select's state is the values of its chosen options, several for `multiple`. Carry's capture and restore, `documentState`, and prepaint's handoff of changed controls call these instead of each listing fields, and a carry record nests the state under `state`, so the key hold types into `state.value`. - A select the patch retains takes its choice back (`restoreCarry`), since it holds the choice in its options, which the patch may rebuild. Other retained nodes are still skipped, so an edit a widget makes to a kept field during the patch stands. - Behaviour that changes besides the fix: a checkbox or radio no longer carries its submission value, which the user can't change, and a text value is never written onto one. A select that has none of the chosen options keeps what it shows rather than falling back to its first option. Selects were left out at #802, because `value` names only a multiple select's first chosen option, and no Leaf surface had one. `skills/leaf/references/page-behavior.md` already promised control state for elements that keep their id and tag. Tests: `test_the_options_chosen_in_a_select_ride_a_reload` (reload, single and multiple) and `test_a_revision_that_rewrites_a_selects_options_keeps_the_users_choice` (live revision) failed before the change and pass now, the first also in Firefox. The focused carry, reload-typing and revision selections (168 browser tests), `pnpm run test:runtime` and the runtime type check pass. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 27, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
One locally selected consumer test fails, and the failure is inherited: test_design_mode_reads_each_shape_of_control_into_the_anchor_its_routes_carry fails its three "a tab's summary" subtests (expected to contain text 'design · Backup ·') identically on main at e1b2b6b. The new select tests, the other carry, reload and revision tests, and pnpm run test:runtime pass.
max-sixty
added a commit
that referenced
this pull request
Nov 27, 2026
<!-- claude-projects-attribution: {"github_login":"max-sixty"} -->
_Requested by **Maximilian** · [project
thread](https://claude.ai/code/project/chan_01HAT2svakg1fTA5kitqhX9w?thread=cmsg_01HAT2svakg1fTA5kitqhX9wERfAJinBvZtiP4jvQpWkPy)_
Converts 86 runtime modules to TypeScript on the infrastructure from
#7424: all of `runtime/state`, `runtime/transport` and `runtime/base`,
and `runtime/lib` apart from the eight modules the Effect UI port is
reworking (leaf-element, controls, widget-events, failure, pending-task,
time-axis, icons, frame-pass) and the generated `syntax-languages.js`.
Each `.ts` sits beside the `.js` the layer serves, which
`build/typescript.mjs` compiles from it. JSDoc types became TypeScript
types, `@typedef`s became `type` declarations (exported only where
another file names them), casts became `as`, and inline `import("…")`
types became `import type`.
**What runs doesn't change.** Parsed without comments, every compiled
`.js` is the same program as the JavaScript it replaces, except
`transport/layer-client.js`: `RequestError` now declares its four
fields, which its constructor already assigned.
Other changes:
- knip takes each TypeScript module as an entry, so the types only a
`.ts` uses count as used. A side effect: knip doesn't report an exported
type in a `.ts` that nothing imports. Value exports are still checked
through the compiled `.js`.
- The keydown-listener register test now counts `base/field-keys.js`,
whose listener a JSDoc cast had hidden from the parse.
- The Worker build's two tests type-check in a project of their own,
`worker/tsconfig.node.json`, with the DOM's and Node's types: the build
imports `state/widget-imports`, whose TypeScript is written for the DOM,
and the DOM's types clash with the Workers runtime's in
`worker/tsconfig.json`. `check:worker` runs both.
- `check:browser` names a compiled `.js` that differs from what its
`.ts` compiles to apart from stale output, and asks for the change to
move into the `.ts` first: a merge from a branch that predates the `.ts`
can bring one, and a plain rebuild would drop it. `build/AGENTS.md` says
the same. Merging main carried #7426's `document-inputs` change into the
`.ts` this way.
- The package references say a TypeScript library module keeps its types
in the `.ts` beside the `.js` a widget imports.
Checks: `tsc` over `browser/types/tsconfig.json` and both Worker
projects, `check:browser`, `test:worker`, `test:runtime` (1197 pass) and
every pre-commit hook on the changed files.
https://claude.ai/code/session_01V22NWabEKzt7s5HiW4koa7
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 27, 2026
…7433) <!-- claude-projects-attribution: {"github_login":"max-sixty"} --> _Requested by **Maximilian** · [project thread](https://claude.ai/code/project/chan_01HAT2svakg1fTA5kitqhX9w?thread=cmsg_01HAT2svakg1fTA5kitqhX9wERfAJinBvZtiP4jvQpWkPy)_ Converts the rest of the runtime that the Effect UI port doesn't hold to TypeScript, following #7429: - dom, readings, records, features, host and annotations - the top-level modules age, bootstrap, check-api, prepaint, stage-integration, validation and widget-api These stay JavaScript: - the port's modules: `dom/box-motion`, `dom/css-anchors`, `annotations/annotation-overlay/`, `effect-widget`, `widget-services` and `portable-api` - `annotations/preview.js`, until the port's #7417 lands **What runs doesn't change.** With comments ignored, each compiled `.js` parses to the same program as the JavaScript it replaces on main, apart from two modules: - `records/thread/address.js`: `claim` is now an arrow, which carries the type a JSDoc `@type` gave the function. Nothing calls it before its definition. - `host/state-application.js`: the copy-on-write of the authored and descriptor maps goes through one `writable` helper. It copies on a reading's first write to a map, as before. Other changes: - A class declares each field it assigns as `declare x: T`, with the type TypeScript inferred from the JavaScript. The strip erases these declarations. - A type is exported only where another module imports it, in this batch and in #7429's modules. - The `.ts` files carry #7426's changes to `bootstrap`, `prepaint`, `records/carry` and `host/application`, merged in at the TypeScript level. Checks run: - `tsc` over `browser/types/tsconfig.json` and both Worker projects - `check:browser`, `test:runtime` (1199 pass), `test:browser`, `test:worker` - `tests/model`: all pass except the bound-file permission test, which fails when the suite runs as root - every pre-commit hook on the changed files An independent review of the conversion found no behaviour change, and its type-level and doc-comment findings are fixed here. --- _Generated by [Claude Code](https://claude.ai/code)_ Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
<select>on the author's page lost the option the user chose when a reload Leaf asks for brought a fresh document, while a text box's words and a checkbox's tick came back. A live revision that rebuilt the select's options lost the choice too, though the patch kept the select.base/document-inputs.jsis now the one home of which state a control carries (controlState,putControlState), replacing the threeholds*predicates that carry's capture, restore anddocumentStateand prepaint's handoff each matched with their own field lists. A select's state is the values of its chosen options, several formultiple. Carry records nest the state understate, so the key hold inbootstrap.jstypes intostate.value. A select the patch retains takes its choice back, since its options hold the choice and the patch may rebuild them; other retained nodes are still skipped, so a widget's edit to a kept field during the patch stands.Worth weighing: a checkbox or radio no longer carries its submission value, which the user can't change. A select that has none of the chosen options keeps what it shows. Two options sharing a value can't be told apart, so a
multipleselect restores both where the user chose one.Max asked for the fix from a Leaf page; Codex reviewed it over three rounds, and its findings are folded in.
Tests: a reload test (single and multiple, also run in Firefox) and a live-revision test, both failing before; focused carry, reload-typing and revision selections (168),
pnpm run test:runtimeand the runtime type check pass.