Repository navigation
feat(sdk): a ready-made shortcuts sheet in patchy/hotkeys - #1107
Conversation
Sol reviewReviewed the stack diff against StandardsNo merge-blocking findings. The props stay within the decided API, the skill describes mounting and customization without prescribing when to add a sheet, and the Release impact answers match the bundled-helper behavior. Spec[P2] Activate the exclusive scope before exposing the dialog — Validation: the package typecheck and all eight focused hotkey tests pass. JSX inference accepts valid chords/sequences and rejects invalid/reserved ones. Once scope activation has completed, focus trapping/restoration, all three closing paths, unmount cleanup, stacked sheets, immediate reopening, phone geometry and unlayered CSS overrides behaved correctly in Chromium and Firefox. WebKit could not launch because host libraries are missing. The expected dependency-age CI failure is excluded from findings; the policy was not changed. No checkout files were changed. Standards: 0 blockers. Spec: 1 blocker, scope activation timing. |
|
Fixed in f0c8b88. The P2 finding was right: the dialog opened in a layout effect, and TanStack switches the sheet's exclusive scope on in a passive effect, so a key that landed between the two reached the page.
The browser test gains a step, "a key pressed the moment it opens waits too". It dispatches
Locally, |
99a1429 to
f59250e
Compare
f0c8b88 to
bee2675
Compare
Rebased onto #1098's Preact 11 fix, and focus returns againI rebased onto Cause. Fix. The dialog opens and closes in a Checks.
|
8de35be to
c3d82f1
Compare
bee2675 to
95f9435
Compare
ce8a529 to
baa68ea
Compare
Acceptance: PASS with notesChecked Three of four fresh agents found Done means
I opened each tracker as Ben. Chromium and Firefox gave the same results:
After Dialog behaviour on Preact 11 I tested two demo patches of my own, in both browsers. The first has groups and the page's own Trace, demo one (Chromium; Firefox identical)
Looks against mock A
Types I typechecked a fresh patch repo against the head's SDK.
Golden journeys
CI on Rollback answers: they match the diff.
Not run
Notes
|
d168798 to
0cf4eae
Compare
baa68ea to
0ef194b
Compare
0cf4eae to
a15d3f8
Compare
<HotkeySheet /> renders a ? button and a modal sheet that it and ? open, listing every labelled hotkey under its new group option, in the company look. While it is open the page's hotkeys wait; Escape, its close button or a click outside closes it, and focus returns. title and hotkey customize it; useHotkeyList still builds any other sheet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…it opens The dialog opened in a layout effect, while TanStack switches the sheet's exclusive scope on in a passive one, so a key pressed in between reached the page. Opening it in a passive effect puts both in the same pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sheet closed its dialog in a passive effect's cleanup. Preact 11 runs that after the next paint, once the dialog has left the page, and a modal dialog closed after its removal returns focus to the body, not to where it was. The dialog now opens and closes in a layout effect, which Preact runs in the commit, before it removes the dialog. The sheet opened in a passive effect only so that it opened in the same pass as TanStack's scope activation. HotkeyScope now holds its scope from the commit, so opening the dialog in the layout phase leaves no gap; the "a key pressed the moment it opens waits too" step still passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
0ef194b to
e993a3a
Compare
## What changed This adds release 33's What's new entry, written from `d5a7862`. It covers everything merged since release 32's `through` (`58d94b3`). It also sets the `patchy` release to `0.33.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | New: patches can have keyboard shortcuts that work as soon as the patch opens, and `?` opens a sheet listing them in the company's look. Repos pick it up at their next refresh | #1098, #1107 | #1146 is release 32's own entry. The shortcuts and the sheet are one change: the sheet lists the shortcuts and has nothing to show without them. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `3f4a842` (release 32) to `d5a7862`:** #1098 and #1107. - **#1098 is labelled `one-way`.** Its answers hold: - Published patches keep working on a rollback, because the helper is bundled into each page. - Refresh and `patchy dev` keep working, because release 32 carries #1099. Generation there leaves out the `patchy-hotkeys` skill it doesn't know, and the CLI removes the folder. - A repo whose page imports `patchy/hotkeys` can't build a new version until production rolls forward. - **#1107** is additive: a new export and an optional option. A repo that uses `HotkeySheet` or `group` can't build on the older release either. - This is why #1099 went out alone in release 32 first. **Rollback line:** If this release misbehaves, roll back to `3f4a842` (release 32). Published patches keep working; a repo whose page imports `patchy/hotkeys` can't publish a new version until production rolls forward again. ## How it was verified - **Tests.** `whatsNew.test.ts`, `schemas.test.ts` and `WhatsNewPages.test.ts` pass (21 tests), and prettier passes on the changed files. - **The range.** - **Sol reviews.** #1098 and #1107 were each reviewed by GPT 6.1 Sol, with re-checks after the Preact 11 fixes. Every finding was resolved. - **#1098's acceptance passed with notes** on its third round. The first two failed on the skill: fresh agents misplaced a dialog's Escape, then used `autofocus`. The third round's agents built trackers that work entirely from the keyboard. - **#1107's acceptance passed with notes.** - **Checks.** Each landed with all 12 required checks green on its final head. - **Not done:** Allison's Edge and real-Mac Mod+Shift+K checks, recorded as a human gate in #1098's body. CI covers Chromium on Linux and an emulated Mac. - **Deploy state.** The live commit, pinned from `/healthz/deep`, is `3f4a842` (release 32). 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. The `0.33.0` bump tells CLIs and patch repos installed before this deploy to upgrade, as every release does. - **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 The `patchy-hotkeys` skill said a shortcuts sheet of your own is built from `useHotkeyList` and `hotkeyKeys` inside a `HotkeyScope`, and stopped there. It didn't say the sheet is a dialog. In #1107's acceptance, an agent's hand-built sheet let Tab leave the patch's frame, and Escape then stopped closing it. The skill now states two things: - **Under Native `<dialog>`,** once, the limit every modal dialog in a patch has. `showModal()` makes the patch's page inert, but not Patchy's page around the frame. Tab past the dialog's tabbable elements leaves the frame for the shell's controls or the browser's, and the keys follow, so Escape can stop reaching the dialog. A modal dialog in a patch therefore keeps Tab among the tabbable elements it has when the key is pressed, or on itself when it has none. The same paragraph corrects focus return: closing returns focus only to an element still in the page, and otherwise focus falls to the body. - **In the sheet section,** what a hand-built sheet must do. Focus moves in as it opens, Tab stays inside, and Escape closes it. Closing puts focus back where it was, or, if that element has gone, in its dialog or on the page. The bullet also says when `HotkeySheet`, which already does all of this, is the better choice. Closes #1137 ## Look at **The two passages.** Under Native `<dialog>`: > The open state is the parent's: the dialog opens as it mounts and closes as it unmounts, which returns focus to where it was while that element is still in the page; if it has gone, focus falls to the page's body. […] > > `showModal()` makes the patch's page inert, not Patchy's page around its frame. Tab past a modal dialog's last tabbable element, Shift+Tab before its first, or either in a dialog with none, leaves the frame for the shell's controls or the browser's. Keys then go where focus went, so Escape can stop reaching the dialog, which stays open. So a modal dialog in a patch keeps Tab and Shift+Tab among the tabbable elements it has when the key is pressed, and on the dialog itself while it has none. In the shortcuts sheet section: > - A sheet of your own is a modal dialog built from `useHotkeyList` and `hotkeyKeys` inside a `HotkeyScope`. Focus moves into it as it opens, Tab stays inside it as under Native `<dialog>`, and Escape closes it. Closing puts focus back where it was, or, when that element has gone, in the dialog it was in, or on the page. `HotkeySheet` already does all of this and runs each command from its button or its keys; build your own when its listing or look won't do. **Before and after, in a scratch tier 1 patch, in Chromium and Firefox.** I built hand-made sheets as `<dialog>`s that list `useHotkeyList` rows with `hotkeyKeys` keycaps inside a `HotkeyScope`. Each opens and closes as under Native `<dialog>`, and Escape closes it through `onCancel`. - **Old:** the old wording, with nothing else. - **New:** the new wording. Tab and Shift+Tab move among the dialog's tabbable elements, found on each key press, or stay on the dialog when it has none. When the opener has gone, closing focuses the dialog it was in. - **Ends found at open:** Tab wrapped between endpoints worked out once as the sheet opens. This was the natural reading of this PR's first wording. The shell had either nothing else focusable, so focus could only go to the browser, or a button I added to the shell page beside the frame, standing in for Patchy's bar. | Case | Old, Chromium | Old, Firefox | New, both browsers | | --- | --- | --- | --- | | Filter field and Close button; Tab past Close | leaves for the browser; Escape: **stays open** | leaves for the browser; Escape closes | wraps to the field; Escape closes; focus back on the opener | | The same, with a button in the shell page | lands on the shell button; Escape: **stays open** | lands on the shell button; Escape: **stays open** | wraps to the field | | Shift+Tab before the field, with a button in the shell page | lands on the shell button; Escape: **stays open** | visits the dialog, then the shell button; Escape: **stays open** | wraps to Close | | No controls, labels only; Tab or Shift+Tab | leaves for the browser or the shell button; Escape: **stays open** | leaves; with the shell button, Escape: **stays open** | focus stays on the dialog; Escape closes | | A row added while open is clicked, then Tab | leaves; Escape: **stays open**. Ends found at open leak the same way | leaves; with the shell button, Escape: **stays open**. Ends found at open leak the same | wraps to the first row | | Sheet opened from a button in a task dialog; that button removed; Escape | focus on `body`, the task dialog still open | the same | focus on the task dialog | So the loss of Escape isn't Chromium's alone. Firefox keeps Escape only when focus goes to the browser itself. <details><summary>Probe traces</summary> Chromium: ``` controls, old, nothing else in the shell Tab x3: field | Close | LEFT for the browser | LEFT for the browser | Escape: sheet STILL OPEN Shift+Tab x3: field | LEFT for the browser | LEFT for the browser | Close (came back round) | Escape: closed controls, old, a button in the shell page Tab x3: field | Close | LEFT for shell-after | LEFT for the browser | Escape: sheet STILL OPEN Shift+Tab x3: field | LEFT for shell-before | LEFT for the browser | LEFT for shell-after | Escape: sheet STILL OPEN controls, new (either shell) Tab x3: field | Close | field | Close | Escape: closed, focus on the opener Shift+Tab x3: field | Close | field | Close | Escape: closed, focus on the opener none, old, a button in the shell page Tab x2: dialog | LEFT for shell-after | LEFT for the browser | Escape: sheet STILL OPEN Shift+Tab x2: dialog | LEFT for shell-before | LEFT for the browser | Escape: sheet STILL OPEN none, new (either shell) Tab x2 and Shift+Tab x2: dialog | dialog | dialog | Escape: closed, focus on the opener rows, old / ends found at open, a button in the shell page clicked "Late command" | Tab: LEFT for shell-after | Escape: sheet STILL OPEN rows, new clicked "Late command" | Tab: "Show shortcuts" row | Escape: closed, focus on the opener opener gone, old: Escape: closed, focus on body | task dialog still open opener gone, new: Escape: closed, focus on dialog#task | task dialog still open ``` Firefox: ``` controls, old, nothing else in the shell Tab x3: field | Close | LEFT for the browser | LEFT for the browser | Escape: closed Shift+Tab x3: field | dialog | LEFT for the browser | LEFT for the browser | Escape: closed controls, old, a button in the shell page Tab x3: field | Close | LEFT for shell-after | shell-after | Escape: sheet STILL OPEN Shift+Tab x3: field | dialog | LEFT for shell-before | shell-before | Escape: sheet STILL OPEN controls, new (either shell) Tab x3 and Shift+Tab x3: field | Close | field | Close | Escape: closed, focus on the opener none, old, a button in the shell page Tab x2: dialog | LEFT for shell-after | shell-after | Escape: sheet STILL OPEN Shift+Tab x2: dialog | LEFT for shell-before | shell-before | Escape: sheet STILL OPEN none, new (either shell) Tab x2 and Shift+Tab x2: dialog | dialog | dialog | Escape: closed, focus on the opener rows, old / ends found at open, a button in the shell page clicked "Late command" | Tab: LEFT for shell-after | Escape: sheet STILL OPEN rows, new clicked "Late command" | Tab: "Show shortcuts" row | Escape: closed, focus on the opener opener gone, old: Escape: closed, focus on body | task dialog still open opener gone, new: Escape: closed, focus on dialog#task | task dialog still open ``` "LEFT" means the frame's `document.hasFocus()` was false. `shell-before` and `shell-after` are the buttons added to the shell page on either side of the frame. </details> ## How it was verified - **The scratch patch.** It was a tier 1 repo initialized against this checkout's local instance. I checked it with Playwright under `patchy dev`, which serves the production shell's frame, CSP and sandbox, in Chromium and Firefox. I didn't publish it. Patchy's bar isn't on the `patchy dev` page, so a button added to the shell page stood in for it. - **Delivery.** `patchy refresh` in the scratch repo reported `"skills":["patchy-hotkeys"]`. Its copy of the skill is now byte-identical to `packages/sdk/skills/patchy-hotkeys/SKILL.md`. - **Checks.** `pnpm format:check` and `pnpm lint` pass. `packages/sdk/src/SdkApi.test.ts`, which packs and serves the project skills, passes 22 of 22. No test or hash covers the project skill's text: `skills-lock.json` hashes only the global `patchy` skill. - **Not run.** `pnpm verify`, which CI runs. WebKit. No fresh agent built a sheet from the new wording; acceptance covers that. **Hit every surface.** These applied: - **The CLI:** the project skill under `packages/sdk/skills`, served by generation. No hash covers it, and refresh delivers it, as above. - **`packages/patchy/README.md`:** its hotkeys part points to the skill for the native `<dialog>` rules and doesn't describe a hand-built sheet, so nothing there needs mirroring. None of the others apply: no wire contract, dev loop, vocabulary, migration, company resource, served page, reverse state or layout change. `hotkeys.ts` needs no change: `HotkeySheet` already wraps Tab over the buttons it has at each key press, always has its Close button, and puts focus back in the dialog the viewer was in when the opener has gone (`restore`, `rescue`). **Left alone.** An SDK change that keeps Tab inside any open modal dialog in a patch is a separate piece of work, to be filed. The Native `<dialog>` example still shows only Escape handling. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Skill text only. It reaches a patch repo at its next `patchy refresh` or dev start. `patchChanges`: none. The text changes how a dialog or sheet gets built, not how an existing patch behaves. - **What does a revert leave behind?** Nothing. Repos refreshed in between keep the newer text until their next refresh. - **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 adding shortcuts each built their own
?sheet fromuseHotkeyList: every one looked different, and each cost the builder time.patchy/hotkeysnow ships one.<HotkeySheet />puts a?button on the page and opens a shortcuts sheet, in the company look, that lists the patch's labelled hotkeys by group. While it is open the page's hotkeys wait; Escape, its close button or a tap outside closes it, and focus goes back.Closes #1093. Stacked on #1098 (base
feat/hotkeys-1092).Look at
1. The sheet, direction A from the mock round. A demo patch published to a throwaway
pnpm dev up teaminstance at this commit, with?pressed. The Patchy look is on an emulated Mac (⌘); the company look is the darklinearfixture, on Linux (Ctrl).Company look, desktop
At phone width it rises from the bottom edge with its own scroll, and its close button becomes a 44px "Close". The demo page's own header wraps the
?button onto a second row in the Patchy phone shot; that is the demo's CSS, not the sheet.2. Customizing stays two additions.
hotkeyis checked likeuseHotkey's:<HotkeySheet hotkey="Ctrl+/" />fails typecheck with'Ctrl+/' isn't a chord: write 'Mod+/', which is ⌘ on a Mac and Ctrl elsewhere. Named groups list in first-seen order; ungrouped hotkeys, the sheet's own "Show shortcuts" included, come last under General; with no groups it is one list with no heading. Anything else is still a sheet of the builder's own fromuseHotkeyList, which now carriesgroup.3. Closing never waits on the dialog's
closeevent. The sheet is a native<dialog>opened withshowModal(), which brings the top layer, an inert page and focus restore. The first browser run caught Chrome firingcloselate: after a click on the close button it arrived only with the next keydown, so the sheet'sHotkeyScopestayed mounted and swallowed that key. Now the sheet's state is the source of truth. The close button, a click on the scrim and the dialog's synchronouscancel(Escape) close it, and unmounting callsdialog.close(), which returns focus. The browser spec presses a page hotkey right after each way out.Decisions worth a glance:
cancel, with no scoped Escape hotkey, so it stays out of the list. TanStack's code settles the two questions this hinged on: a scope holds the page's hotkeys back whether or not it registers any, and a held-back match doesn't cancel the key's default. So a page's ownEscapehotkey waits and the dialog still closes; the spec has one.patchy/_generated/look.css, which the build inlines. So the first sheet mounted adds one<style>to<head>, in@layer patchy-hotkeys. It lands after the look's@layer look, so it beats the look'sbuttonandh2styles, and the patch's own unlayered CSS beats it.<HotkeySheet />stays one line with no import to remember, and the frame's CSP allows inline styles. It reads only--look-*tokens, each with a system colour when a page has no look, and nothing animates.title, "Keyboard shortcuts" by default, so it names the dialog it opens.How it was verified
packages/patchy/src/hotkeySheet.test.ts: groups in first-seen order, ungrouped last under General (joining a named General), one unnamed list when nothing has a group.packages/patchy/src/hotkeys.test.ts: the published declarations acceptgroupandHotkeySheet({ title, hotkey }), and refusehotkey: "Ctrl+/"withuseHotkey's message.<HotkeySheet hotkey="…" />in JSX was checked by hand against the same declarations:Mod+/passes,Ctrl+/andMod+Shift+Kare refused.test/browser-tier1/hotkeys.spec.tsadds the sheet in the published frame:?opens it and focus moves to its close button; the listing by group with each hotkey's keys; the page'sL,G HandEscapewait while it is open; Tab and Shift+Tab stay inside; Escape, the close button and a click on the scrim each close it, focus returns to where it was, and the next page hotkey fires at once. It failed on the latecloseevent above before the fix.pnpm check: format, lint, typecheck and synth pass.pnpm test: 2590 of 2605 pass. The 15 failures are CLI tests whose stub server received a strayGET /from a local port prober on this machine, a different set on a rerun, plus two load flakes that passed on rerun; none touch hotkeys.pnpm test:postgres-concurrency: 28 passed.pnpm test:browser, the full tier 1 suite: 80 passed.pnpm test:packed-preact-e2epasses. Opening and closing the sheet now run in a layout effect, so focus returns to the opener on close. The new export needs no change to the package build: it lives in the existingpatchy/hotkeysentry, and its hooks share the page's Preact asuseHotkey's do.Release impact
Additive: a new export, a new optional hotkey option and a new optional field on
ListedHotkey. Nothing server-side.HotkeySheetorgroupand refreshes to a release without them fails its build until it drops them.Built by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, through T3 Code.