Repository navigation
Let widgets own keyboard context bindings and hints - #1654
Merged
Merged
Conversation
Move badge and accessible route presentation from Ask to the shared keyboard layer. Declared bindingBadge seats and explicit null corner requests work for widget-owned commands, including forwarded scopes, without Decision metadata. Native and ARIA disabled controls make commands unavailable at the same boundary as dispatch; disabled routed commands retain their keys without invoking a shared handler or exposing an outer action. An explicit route corner request overrides a row seat. Cover native editing, scope changes, replacement, alias merging, disabled rows and routes in real-browser tests, and add a standalone gallery and screenshot state.
Declare concise titles, optional descriptions, and boolean Decision roles throughout the runtime and bundled packages. Compile explicit contextKeys as references to their original commands at local and Ask-associated scopes. Remove Ask digit allocation and the mandatory answering-widget wrapper. Keep native editing ahead of contextual aliases, reserve unavailable digits, and preserve stable option identities through generated choices and undo. Replace synthetic Ask-action assertions with real command availability and execution regressions across hints, ARIA, the bar, reference, and source lifetime. Regenerate the gallery corpus and registry reference for the new contract.
leaf-agent
reviewed
Oct 3, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The command-title migration leaves test_a_reference_command_finishes_its_gesture_before_a_newer_control unable to reach the behavior it tests. commenting() now exposes comment on the control, while the test locates the exact accessible name Comment on the control; both parameterizations fail at to_be_visible() before dispatch. I reproduced the arrival failure in isolation. Align the title or the locator, then run both cases so this gesture regression remains covered.
leaf-agent
previously approved these changes
Oct 3, 2026
leaf-agent
approved these changes
Oct 3, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 14, 2026
Strict `tsc` covered only `build/browser/*.ts` and the seven runtime modules marked `// @ts-check`; the other ~240 files under `skills/leaf/assets/runtime/` were unchecked. `pnpm run check:browser` (and so `pnpm run check`, the PR `test` job and `wt merge`'s pre-merge `node-checks`) now runs a second, non-strict `checkJs` program over every runtime module and the render checks pages import from `/checks/`. It found about 400 errors on main, and this PR clears them, mostly with JSDoc types, casts and narrowing. ## How the gate is wired - `build/browser/tsconfig.runtime.json` is the non-strict program. `paths` resolves the runtime's rooted imports (`/vendor/…`, `/runtime/…`, `/checks/…`). Its `include` also pulls in Web Awesome's `copy-button` and `input` declarations, which add those tags to the tag map. - `build/browser/tsconfig.json` now includes every runtime module (unchecked unless it carries `// @ts-check`), so any module that opts into strict mode is checked strictly, whether or not the framework imports it. - `build/browser/build.mjs` (`typecheck`) runs both programs. tsc checks a JS file wherever an import reaches it, under the options of the program it's in, and has no per-file opt-out. So from the runtime program the build drops diagnostics in vendored third-party bundles and in files the strict program owns (`.ts` and `// @ts-check`). Every other diagnostic fails the build. The runtime program takes about 1.2 s. - The framework's types reach the runtime through a generated `skills/leaf/assets/vendor/browser-runtime.d.ts` (`export * from "…/build/browser/index.ts"`). Before, tsc inferred them from the compiled facade (types blanked) and the minified Lit bundle, which produced bogus errors such as `render(): symbol` on `LitElement` subclasses. This file ships in the layer like the `.LICENSES.txt` files beside it; nothing loads it at runtime. - `build/browser/runtime-globals.d.ts` declares, in one place: - what `prepaint.js` and `bootstrap.js` hang on `<html>` (`lfInitial`, `lfStorage`, `lfKeyboard`, `lfChrome`, `lfViews`, `lfInputs`, `lfDocumentLifetime`, `lfStartupException`, `lfSample`) and on `window` (`lfSampleBridge`); - the entry script's `lfDocumentPort` and `lfRenderingState`; - the events dispatched with a detail (`lf-startup-failed`, `lf-command-invoked`, `lf-held-keys`, `lf-reveal`, …); - the runtime's custom elements by tag, through a `@typedef` beside each class. The scripts' assignments are checked against these declarations. ## Declarations corrected at their owner `application.ts` didn't declare served-state fields the runtime already reads: `files` (each binding's stamp), `browser.version_notes`, `browser.history`, the undo entries' `newest`, the report feed's fields, and a to-do subject of kind `element`. `thread/model.js` now accepts the readonly thread snapshots its callers pass. `askValue` takes an `Immutable` widget. `retainUserIntent`, `watchArrivals`, `rowWalk`, `closeLayer` and similar functions get parameter types where defaults had inferred narrower ones. ## Behavior the types exposed - **Bug, fixed:** `queue-walk.js` subscribed to `effective.queues.questions`, a field #2783 renamed to `on_user`. The selection was always `undefined`, so the walk never asked for a key repaint when On me emptied or filled. It now selects `on_user`. `tests/runtime/queue-walk.test.mjs` covers it: it fails on the old line and passes on the new one. - **Dead code, removed:** `comment.create` declared `description: () => commentDestination().description`. `commentDestination` stopped returning `description` in #1654, so the field always answered `undefined`; every consumer resolves it through `word()`/`descriptionOf`, so removing it changes nothing. - Two edits change code shape without changing behavior: a boolean subtraction in a sort comparator now goes through `Number()`, and two Lit directives' `render()` now declare the values `update()` already received. ## Checks `pnpm run check`, including `test:runtime` (423 tests), passes. Focused pytest `tests/model/test_unused_exports.py`, `test_interact_layer.py`, `test_distribution.py` and `test_module_url_delivery.py` (238 tests) pass. Pre-commit passes on every changed file. An injected property error in a runtime module fails `check:browser` with the diagnostic. Not covered yet: `skills/leaf/assets/leaf.js` and the packages' widget modules sit outside `runtime/` and aren't in the runtime program. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[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.
Ask currently assigns digits from its available actions, so a widget depends on Ask for numeric shortcuts and removing an action can change another action’s number. This change gives widgets explicit
contextKeysand stable numeric assignments, then forwards references to their original commands at the question opening, margin representatives, and Ask-associated threads. Page-levela/Anavigation remains the same.The shared keyboard layer now drives dispatch, inline hints, the shortcut bar, the command reference, and ARIA from one availability reading. Native editing takes priority over context aliases, unavailable bindings reserve their key, and replacing or disconnecting a source withdraws its routes. Generic hints work with both the default annotation overlay and page-owned annotations.
title, optionaldescription, and booleandecisionroles; all bundled providers are converted.Focused browser verification covers keyboard scoping, shared draft editing, native digit entry, forwarded Save/Cancel, and control replacement. The integrated runtime passes 194 runtime tests, TypeScript checks, a reproducible vendor rebuild, and pre-commit checks; the browser-framework and worker suites passed 74 and 66 cases respectively. The 56 instruction-runner tests pass, and the targeted authoring comparison scored base 0/1 versus candidate 1/1 with zero execution errors. Served startup profiles both reach authoritative presentation without browser errors; the shared hint renderer adds one JavaScript request and 10,100 JavaScript bytes. The corpus matches its canonical generator. CI runs the current merge’s everyday and changed nightly gate plus website delivery checks.