Repository navigation
feat(sdk): keys for one element, text fields keep their keys, and the shortcuts sheet runs a dialog's commands - #1231
Conversation
|
Review (GPT 6.1 Sol, xhigh), three rounds before the PR opened. Now PASS, with no findings.
Beyond the findings, Sol verified:
Fix 1 changes one behaviour, and Sol judged it consistent with "the narrowest place wins": an element whose sequence starts with |
Acceptance: PASS with notesChecked I built a tier 1 patch from Done means
Browser checks (47)The PR's own tests
Golden journeys
Rollback answers: they match the diff. There are no migrations, no Release impact: honest about patches built before. Published patches keep their bundled SDK until they are republished. The Not run
Notes
|
|
After the acceptance verdict on |
…ld, and a sheet that runs a dialog's commands Agents moving patches onto patchy/hotkeys needed keys that only work in one place, so they fell back to onKeyDown or `enabled: focused`. A page's Mod+A took a field's select-all, a widget's own Escape also closed its dialog, and a dialog's single keys couldn't be reached from its fields. - `within: ref` ties a hotkey to one element, SVG included. The narrowest place wins: element, then dialog, then page, even over a page sequence in progress. A key the narrower place doesn't take goes on. - A text field keeps the keys that type, compose or edit text, for chords and sequence steps alike, whatever whileTyping or within say. A hotkey within a one-line field takes its plain Enter, Escape, up and down. - A key something else already preventDefault-ed fires no hotkey and steps no sequence. Patchy consumes matched chords itself; the TanStack patch gains a per-step check and per-target sequence ownership. - The sheet opens with ? and Mod+/, inside dialogs too, and lists the commands for the current context as buttons. Running one closes the sheet, puts focus and the selection back, runs it and announces it. - `patchy init`'s page saves on Enter through a within hotkey, Tab reads "Tab" off a Mac, and the hotkeys skill, README and glossary say all of this. Closes #1226 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the sheet's own keys
- A step a narrower sequence takes, its first included, is no step for a
sequence further out: the TanStack patch records the innermost target
that took the event, and sequences further out reset instead of taking
it. Page `G H` beside `H X` within a panel no longer completes on H.
- Eligibility is pure. Patchy marks an event as its own only when a chord
or a sequence step actually takes it, through the patch's new `onStep`,
so a widget that handles a key after an inner hotkey's look still stands
every hotkey down.
- The sheet keeps Escape and Tab at every step: a command such as
`G Escape` or `Tab A` runs from its button alone while it is open.
- `whileTyping: false` holds a hotkey back in every text field, even the
one it is `within`.
- The announcer is a status region that moves into the modal `<dialog>`
around where focus was, so a native modal doesn't make it inert.
- The skill's SVG example writes `tabindex={0}`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…f a modal A command run from the sheet could close the native dialog it came from and leave it mounted, close a nested one, or open another modal. The announcer stayed where the sheet had put it, inside a hidden dialog or under the new modal, so Chromium's accessibility tree had no status region. Once the command has rendered and focus has settled, the announcer's home is the modal dialog around focus, or the body. When that differs from where it is, it moves there and says the label again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1763b28 to
04af1b3
Compare
…ges publish (#1241) ## What changed This adds release 36's What's new entry, written from `1acc968`. It covers everything merged since release 35's `through` (`dd0e2ec`), and sets the `patchy` release to `0.36.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | Improved: shortcuts work where you use them (keys for one part of a patch, the closest wins, text boxes keep their typing keys) | #1231 | | Improved: the shortcuts sheet shows what works where you are (Ctrl+/ and ⌘/ open it, its commands run, it opens from a patch's menu and in view on a narrow screen, keeps the look, spells keys out away from a Mac) | #1231, #1181, #1178, #1180, #1177 | | Fixed: keys pressed while a patch opens reach it | #1183 | | Fixed: pages styled with Tailwind 4 publish, and a look with the same rule saves | #1191 | | Fixed: an old copy of a patch no longer replaces newer work (**Breaking** for such a copy: it needs `patchy pull` or one `--allow-behind` publish) | #1179 | | Improved: your agent can check a publish before sending it | #1188 | | Improved: your agent hears what changed when it updates a patch | #1186, #1185 | | Fixed: your agent stops chasing false alarms (`pnpm install` exit codes, `manifest.json` bytes, the description notice, a copied dev record) | #1176, #1174, #1175 | | Behind the scenes: fuller hotkeys instructions for agents; fewer redraw costs for patches with many shortcuts | #1182, #1187 | `patchChanges` has three sentences for the agent refreshing a patch across this release: - #1231's, from its PR: text fields keep their keys, `preventDefault()`, and the sheet's Mod+/ and `.hotkey-row` buttons. - The sheet's dialog renders in `document.body`, and element-only page rules don't reach it (#1178, #1180). Its own row lists last (#1181). The hotkey label helpers take only valid literals (#1177). - Publish's `unknown_base_version` (#1179). It also rewords release 33's "Press ? to see every shortcut a patch has". That was true only for a patch that mounts the shortcuts sheet, so it now says a patch *can* list its shortcuts. The rest get no line: - #1206, #1207, #1209 and #1220 are `pnpm dev eval` tooling. - #1222 is release 35's own entry. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`, and release 33's reworded line. - **Rollback safety, from the live commit `d28fdd0` (release 35) to `1acc968`:** - #1191 is labelled `one-way`. Its Release impact: a company look published after this release with a nested `@supports` condition stays stored after a revert. Release 35 refuses any bundle carrying it, so repo publishes in that company would fail until an admin runs `patchy look restore` to an earlier revision. Pages and Tailwind 4 repos already published stay published. - #1183 is the only change to what the server serves browsers: the shell's script, under a digest-named URL. Its revert leaves nothing behind. - The hotkeys PRs change `patchy/hotkeys`, which patches bundle when they are built. Published patches keep their copy. - The CLI PRs change what a CLI writes and refuses. Release 35 reads everything they leave behind: #1176's `allowBuilds` entry, #1174's indented `manifest.json`, and the `version` recorded by an `--allow-behind` publish. **Rollback line:** If this release misbehaves, roll back to `d28fdd0` (release 35). First check that no company's look has a nested `@supports` condition, and `patchy look restore` an earlier revision where one does (#1191). ## How it was verified - **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and `schemas.test.ts` pass (22 tests), and `bun fmt` passes on the changed files. - **Facts.** The sheet's new `document.body` home and its element-rule reset were checked against `hotkeys.ts` and `hotkeySheet.ts` on main. - **Deploy state.** I pinned the live commit from `/healthz/deep`: `d28fdd0` (release 35). The Deploy run updated last succeeded, and none is unfinished. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Text and version numbers only. Like every release, the `0.36.0` bump tells CLIs and patch repos installed before this deploy to upgrade. - **What does a revert leave behind?** Nothing. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>


What changed
Agents moving patches onto
patchy/hotkeyskept needing keys that only work in one place: arrows in a list, Enter and Escape in an inline editor, P 5 and A in a Create task dialog. Hotkeys couldn't be tied to an element, so they fell back toonKeyDownor faked it withenabled: focused. A page'sMod+A"Select all" also took a field's select-all, and a widget's own Escape also closed the dialog around it.Now:
within: refties a hotkey to one element, SVG included. The narrowest place wins, the element, then the dialog, then the page, even over a page sequence that is under way. A key an element's sequence takes as a step is no step for a sequence further out. A key the narrower place doesn't take goes on to the next.whileTypingorwithinsay: typing, composition and dead keys, and the editing keys. Other Mod chords and Escape still fire, and a hotkey within a one-line field takes its plain Enter, Escape, ↑ and ↓.whileTyping: falsewaits in every text field, even the one it is within.preventDefault()fires no hotkey and steps no sequence. Keys Patchy took don't count, soGbesideG Hstill fires.?and Mod+/, inside dialogs and from fields. It lists the commands for the current context, each a button. Running one closes the sheet, puts focus and the selection back, runs it and announces it. Escape and Tab are the sheet's at every step, so a command likeG Escaperuns from its button there.patchy init's page saves on Enter throughuseHotkey("Enter", save, { within: field }), and Tab reads "Tab" off a Mac.Closes #1226
Look at
Keys for one element. A listbox with
withinkeys, an inline editor inside it, and the page's ownMod+A. In the editor, Ctrl+A selects its text; on the list, it selects every task.keys-for-one-element.mp4
A dialog's commands from its fields. From the description field, Ctrl+/ lists Create task's commands. P then 5 runs Priority 5 and the caret comes back. Tab and Space run a command as a button, and Escape closes only the sheet.
a-dialog-s-commands-from-its-fields.mp4
The clips are Chromium on Linux, so ⌘ reads Ctrl. They film a demo page published to the browser tier's throwaway instance.
Review. GPT 6.1 Sol reviewed three rounds before this opened (6 findings, then 1, then none); its summary is in a comment.
The TanStack patch (
patches/@[email protected], about 35 changed lines inhotkey-manager.js):allowStep, Patchy's pure per-step check.onSteptells Patchy a step was taken, which is when it consumes the key and marks it as its own.Targetwidens toElementin the types, which the runtime already accepted.Reverting each fix turns the browser tier red:
Global ownership again: the list's
Hloses to the page'sG H.Sequences further out take a narrower step again: with
H Xwithin a panel,G H Xalso fires the page'sG H.The eligibility probe marks the key again: a part inside a widget looks at H first, the widget then handles it, and the page's
G Hstill completes.Only a whole
EscapeorTabis the sheet's:Tab Aswallows the sheet's first Tab, andG Escapecloses the dialog under the sheet.whileTyping: falseignored within the field: the editor's ownMod+Kfires instead of passing to the page's.The announcer left in the body: over a native modal dialog, Chromium's accessibility tree has no status region. With it homed only when the sheet opens, a command that opens another modal, or closes its dialog and leaves it mounted, leaves no status region either.
Calls the issue didn't settle, made the simplest way, easy to change:
?and one for Mod+/, stay plain rows, not buttons. Running "open the sheet" from the sheet would only reopen it. Pressing either key while it is open closes it.tabindex="-1"if it has none, so focus can go to it.whileTyping: truechanges nothing" is read strictly. From a field, only the listed keys leave: other Mod chords, Escape and a one-line field's own keys. So a bare F2 or Tab hotkey waits in a field even withwhileTyping: true.How it was verified
Checks:
pnpm format:check,pnpm lintandpnpm typecheckpass on the head, rebased onto main.Unit and type tests:
hotkeys.test.ts,hotkeyRules.test.ts,hotkeySheet.test.tsandinitProject.test.tspass, 34 tests, plusSdkApi.test.ts.withinagainst the published types, with HTML, SVG andElementrefs, and refuse a non-element.within,whileTyping: falsewithin the field, read-only inputs and textareas, and Mod as ⌘ on a Mac.The scaffold: the
cliRepo,cliRepoBuildandcliRepoPublishcases pass. A new tier 1 repo typechecks, builds and publishes with the hotkey.Browser tier:
pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium test/browser-tier1/hotkeys.spec.tspasses, 6 tests. The new test covers:Hagainst the page'sG Hunder way, a panel'sH Xagainst it, an SVG chart'sG Hagainst the page's, and the page'sG Tunable to start in the chart;whileTyping: falseMod+Kpassing to the page's;=not opening the sheet;Gwith aG Escapecommand, and the dialog's own Shortcuts button;The sheet test now checks that listed keys run, unlisted ones wait, and Tab goes round past a
Tab Acommand.The layout and narrowest-wins cases the issue lists under unit tests are in the browser tier. The unit suite runs in Node with no DOM, and these need real key events moving through elements.
Not checked:
pnpm verifyis left to CI.Release impact
Tick exactly one.
From a grep of our own published patches:
Mod chords keep working. Every
whileTyping: truein them is on a Mod chord, mostlyMod+Enterto save or submit, or the zoom and font keys.No bare Enter hotkey fires in a textarea today, and no patch lets a printable key fire in a field.
One dialog submits once instead of twice. Its form's own
onKeyDownhandles Enter, so ⌘↵ submitted from the form and again from theMod+Enterhotkey. The hotkey now stands down.Patches with
HotkeySheetgain Mod+/ as an opener. Each sheet now lists only the commands where focus was, and runs them. None bindsMod+/itself, and each mounts one sheet at a time.A restyled sheet row may lay out differently. Each command row's label and keycaps now sit inside a
<button>. A patch whose own CSS restyled.hotkey-rowshould check the sheet when it republishes.What does a revert leave behind? Nothing on the server. Patches published with this SDK bundle it and keep it until they are republished.
Does the release before it still work with that? Yes.
patchChangesfor the release that ships it:Built by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, through T3 Code.