Skip to content

feat(sdk): HotkeySheet's own row takes a group, and openHotkeySheet opens it from a page's control - #1181

Merged
allisonmahmood merged 1 commit into
mainfrom
feat/hotkey-sheet-group-and-open
Nov 4, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
feat/hotkey-sheet-group-and-open

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What changed

The shortcuts sheet's own "Show shortcuts" row always listed under General, which forced a one-row General column on a patch that groups its keys. With no groups, it listed before the page's keys, because a child's hotkeys register before its parent's. Patches worked around it by registering their keys in a separate child ahead of the sheet. Nothing but the sheet's own ? button and key could open it, so a patch whose narrow layout reaches shortcuts from a menu item kept a hand-built sheet. Now <HotkeySheet group="…" /> puts its row in one of the page's groups, and the row lists after the page's keys wherever it sits. openHotkeySheet() opens the mounted sheet from a control of the page's own.

Closes #1159

Look at

  • sections(list, own) in packages/patchy/src/hotkeySheet.ts moves the sheet's own row after the page's hotkeys before grouping, so it lists last in its section. A group made only of that row comes after the page's groups. It recognises the row through TanStack's normalisation on both sides, so <HotkeySheet hotkey="j" />, registered as J, is still its own row.
  • openHotkeySheet() in packages/patchy/src/hotkeys.ts opens the mounted sheet through the same state as its ? button. It warns in the console when no sheet is mounted. Focus is the dialog's own: it moves to the close button and goes back to the control that opened it.

The browser case's page registers its keys in the parent and mounts <HotkeySheet group="Navigation" /> in a child, so the sheet's row registers first. On the head:

["Navigation", ["Go home: G H", "Go to timeline: G T", "Show shortcuts: ?"]],
["Tasks",      ["Create task: C T"]],
["General",    ["Next: L"]]

Before, the row would have listed first, under a General column of its own. A new step clicks a page button that calls openHotkeySheet() with the sheet's button hidden. It expects the sheet visible with its close button focused, then Escape returns focus to that button.

How it was verified

  • pnpm exec vitest run packages/patchy/src/hotkeySheet.test.ts packages/patchy/src/hotkeys.test.ts: the new sections cases cover the row last in its group and last in an ungrouped list, and a lowercase hotkey prop against its registered capital. Each was red before its change. The published types accept group and openHotkeySheet().
  • pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium test/browser-tier1/hotkeys.spec.ts: 5 passed at 09e9a6e.
  • Locally: format, lint, pnpm typecheck, pnpm typecheck:tests, and the hotkeys and SDK skill tests (hotkeys.test.ts, hotkeySheet.test.ts, hotkeyRules.test.ts, SdkApi.test.ts), all passing. No full pnpm verify ran locally: the machine is shared and heavily loaded, so CI's full suite is the judge.

The patchy-hotkeys skill states both, as do the README's sheet paragraph and the glossary's shortcuts sheet entry.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Additive SDK API: a group prop and an openHotkeySheet export. A sheet without group still lists its row under General, now after the page's keys.

  • What does a revert leave behind? Patches built with this release keep working, because the sheet is in their bundle. A patch that adopted group or openHotkeySheet() would fail its typecheck when rebuilt against a release without them.
  • Does the release before it still work with that? Yes. No schema, API or server change.

Built by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:m 100-500 changed lines labels Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

The hotkeys browser spec ran at this head:

pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium test/browser-tier1/hotkeys.spec.ts

✓ patchy/hotkeys fires in the published frame across fields, scopes, layouts and a Mac
✓ a component's hotkeys are live from the commit that mounts it to the one that removes it
✓ a conflict warning waits for every hook's update, so siblings swapping keys don't warn
✓ the sheet opens by ? or its button, lists by group with its own row last, holds the page's hotkeys and closes like a dialog
✓ a page's element rules don't reach the sheet, which takes the page's font without a look and its button follows one
5 passed

The sheet case covers the own row last in its group, the hidden-sidebar open from #1157, and openHotkeySheet() from a page button with focus back on it.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Re-check (GPT 6.1 Sol, xhigh) on fb25e86: PASS for this PR's change. The own-row normalisation matches TanStack's registration across 958 supported chords plus sequences, in Chromium and Firefox with Linux, macOS and Windows detection. That's 2,876 cases per combination, covering lowercase letters, modifiers, sequences, +, Mod++ and Space. The lowercase test fails with the raw comparison. It's blocked only by #1180, which it's stacked on.

@allisonmahmood
allisonmahmood force-pushed the feat/hotkey-sheet-group-and-open branch from fb25e86 to 465c8df Compare November 1, 2026 17:48
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Re-check (GPT 6.1 Sol, xhigh) on 465c8df: PASS for its own changes. The rebase keeps the grouping, own-row ordering, lowercase normalisation, openHotkeySheet() and focus return. It inherits #1180's open findings.

@allisonmahmood
allisonmahmood force-pushed the feat/hotkey-sheet-group-and-open branch from 465c8df to b9ed80a Compare November 1, 2026 18:08
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Re-check (GPT 6.1 Sol, xhigh) on b9ed80a: PASS for this PR's changes. It sits directly on #1180. Grouping, own-row ordering (lowercase j matches the registered J), opening from code and focus restore are intact. 5 browser cases and 32 focused tests pass.

@allisonmahmood
allisonmahmood force-pushed the feat/hotkey-sheet-group-and-open branch from b9ed80a to 09e9a6e Compare November 1, 2026 18:26
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 09e9a6e (base 5f05bf1, the head of #1180) on team, by Claude Opus 5.5 in Claude Code.

I built a tier 1 patch from the environment's CLI to exercise this:

  • The page registers its keys in the parent component and mounts <HotkeySheet hotkey="k" group={…} /> in a child, so the sheet's own row registers first.
  • It has a "Shortcuts" button in a toolbar, and a Menu whose "Keyboard shortcuts" item closes the menu and calls openHotkeySheet().
  • A select moves the row's group, and a checkbox unmounts the sheet. At 390 wide the page hides the ?.
  • A twin of the page is built against the base's bundle, without group or openHotkeySheet.

I opened both as Ada in Chromium.

Done means

  • A patch can put the sheet's row in one of its groups, and the row lists after the page's keys wherever it sits: passed.

    Sheet Listing
    Before, no group Navigation · Tasks · General: Show shortcuts K, Next L
    group="Navigation" Navigation: Go home, Go to timeline, Show shortcuts K · Tasks · General: Next L
    group="Help" Navigation · Tasks · Help: Show shortcuts K · General: Next L
    no group Navigation · Tasks · General: Next L, Show shortcuts K
  • A patch can open the sheet from its own control, with focus handled as the ? button handles it: passed for a control that stays on the page. It has a gap for menus that close (note 1).

    • Toolbar button, by click and by Enter: the close button takes focus. Escape or the close button sends focus back to the toolbar button.
    • Menu item that closes its menu, by mouse and by keyboard: the sheet opens with its close button focused. After Escape, focus is on body. The ? button sends focus back to itself.
    • On a phone, with the ? hidden, the menu item opens the sheet as a bottom sheet, fully in view (top 417px, bottom 844px of an 844px viewport).
    • With no sheet mounted, nothing opens and the console warns patchy/hotkeys: openHotkeySheet() found no <HotkeySheet /> mounted to open. Once the sheet is mounted again, the call opens it.
  • The skill states both: passed. The patchy-hotkeys skill, the README and the glossary describe group and openHotkeySheet().

  • The focused unit tests pass at this head: hotkeySheet.test.ts, hotkeys.test.ts and hotkeyRules.test.ts, 10 tests.

The sheet's own row, before and after, with hotkey="k" and group="Navigation"

On a phone, with the ? hidden, the menu item opens the sheet

Golden journeys

  • Use a tier 1 tool: passed. The patches open in their frames with a 200 and no console errors. No other journey reaches patchy/hotkeys.

Rollback answers: they match the diff. This adds SDK API without changing the server. Published bundles keep working after a revert, and repos that adopted the new API stop building until production rolls forward again, as with any new helper.

Not run

  • The hotkeys browser spec locally: CI's browser job passed on this head. pidgeon-suite was still pending when I checked; every other check had passed.

Notes

  1. A menu that closes leaves focus on body. Most menus close when an item is picked, and that's the case the issue started from.
    • In that case the skill's line "goes back to that control when it closes, as with the ? button" doesn't hold: the control is gone by the time the sheet closes.
    • Focusing the menu's trigger before calling openHotkeySheet() fixes it. In the same patch, focus then went back to the Menu button.
    • That workaround is worth a sentence in the skill. Alternatively, openHotkeySheet could take the element to return focus to.

@allisonmahmood
allisonmahmood force-pushed the fix/hotkey-sheet-page-styles branch from 5f05bf1 to 4fd1683 Compare November 4, 2026 02:06
allisonmahmood added a commit that referenced this pull request Nov 4, 2026
…t finishes without a look (#1180)

## What changed

A page's ordinary element rules restyled the shortcuts sheet by
accident. One page's `kbd { … }` shrank every keycap, another's hid
them, and a `button { … }` rule redrew the `?` and close buttons. On a
page without the company look, the sheet drew in the system font with an
ink frame and an offset shadow that matched nothing, and the `?` button
had no hover. Now the page's rules made only of element names, however
long, such as `kbd`, `html body kbd` or `body dialog`, don't reach the
sheet or its button. Rules aimed at the `hotkey-*` classes still restyle
them. Without a look, the sheet and button take the page's font and text
colour, with hairlines and no shadow. With a look, the `?` is one of the
look's buttons, square, with the look's height and hover.

Closes #1158

## Look at

**A page without the company look**, with its own `kbd` and `button`
rules. Before, the page's green button rule and dark keycap rule reach
the sheet, and it draws in the system font with a black frame and an
offset shadow. After, it draws in the page's serif and text colour, with
hairlines:

| Before | After |
| --- | --- |
| ![Before: the sheet without a
look](https://github.com/user-attachments/assets/a98edd3b-65e8-4c22-82f2-6f21025618eb)
| ![After: the sheet without a
look](https://github.com/user-attachments/assets/c46ad455-0ccd-4f98-83d6-944298e2e41e)
|
| ![Before: the ? button,
hovered](https://github.com/user-attachments/assets/e84c25ea-9ac6-4817-84cd-6545c217687d)
| ![After: the ? button,
hovered](https://github.com/user-attachments/assets/23fefce5-5525-4619-8a9e-41e047b24c70)
|

The button row is hovered: before, it was the page's green button with
no hover feedback; after, it has a hover tint.

**With the Patchy look**, the sheet itself is unchanged, and the `?`
becomes one of the look's buttons. This is the call to check: "follows
the look's control size and hover" read literally makes it the look's
plain button, which in the Patchy look is the blue primary. The look's
hover only makes sense on the look's own resting colours, so the colours
come with it.

| Before | After |
| --- | --- |
| ![Before: the ? button in the Patchy
look](https://github.com/user-attachments/assets/9feeca16-eae9-4f99-ab92-8ac48d895b19)
| ![After: the ? button in the Patchy
look](https://github.com/user-attachments/assets/4c5bc0a3-7039-40da-90f4-bb4b0462b321)
|

![After: the sheet in the Patchy
look](https://github.com/user-attachments/assets/94f8c2da-3c2b-4117-b1fc-30f0cee9cc5a)

These screenshots render the real `HotkeySheet` from each commit's
source, bundled into one page in Chromium, without the Patchy frame. The
base is #1157's head.

**How the stylesheet is built** (`packages/patchy/src/hotkeySheet.ts`):
two `<style>` elements.

```
first in <head>, unlayered, moved back first each time the sheet opens:
  .hotkey-opener, .hotkey-sheet-dialog, .hotkey-sheet-dialog *,
  .hotkey-sheet-dialog::backdrop { all: revert-layer }
  .hotkey-sheet-dialog, .hotkey-sheet-dialog * { direction: inherit; unicode-bidi: normal }
                                                  one class outranks any number of element names; every page
                                                  stylesheet comes after it, so a page's one-class rule such as
                                                  `.hotkey-key` wins the tie; `all` leaves out direction and bidi
after the page's styles, once:
  @layer look.patchy-hotkeys { .hotkey-opener … } inside the look's layer, beneath the look's own rules:
                                                  the page's layered button styles make it one of its buttons
  @layer patchy-hotkeys {                         declared after the page's existing layers:
    .hotkey-sheet-dialog, … * { all: revert }     past every author layer, so e.g. Tailwind's preflight in
    … :focus-visible { outline: revert-layer }    `@layer base` doesn't reach the parts; focus rings come back
    the sheet's defaults …                        then drawn from the look's tokens
  }
```

**The contract:** element rules in the page's stylesheets, layered or
not, don't reach the sheet. Its unlayered rules with a class, attribute
or pseudo-class can, `button:hover` included, and so can layers declared
after the sheet first mounts. The `?` button also takes the page's
layered styles, as the page's own buttons do, which is how it follows
the look.

- Blocked: element rules of any length, wherever they sit, such as
`kbd`, `html body kbd` inside `@media`, `html body dialog div div
section ul li span kbd`, and a Tailwind-style `@layer base { kbd { … }
button { … } }`, including rules added to that layer later. `direction`
and `unicode-bidi` on `kbd` or on the `dialog` are blocked too: on a
right-to-left page, the sheet stays right to left.
- Not blocked: unlayered rules with a class, attribute or pseudo-class,
such as `button:hover` or `.dark kbd`.
- Always wins: the patch's unlayered rules aimed at the `hotkey-*`
classes, a single class included, as in `.hotkey-key { … }`. That holds
even for one prepended to `<head>` after the sheet mounted, since the
sheet moves its reset back first as it opens. A hover restyle names the
state with the class: `.hotkey-opener:hover`.
- Documented limits: layers the page declares after the sheet first
mounts; class rules inside the page's earlier layers, which the layered
reset wipes like element rules; and a page that replaces `<head>`
wholesale, which loses the reset until the sheet next opens.

The `button:hover` choice was deliberate: a patch's deliberate
`.hotkey-opener` restyle matters more than blocking an accidental hover
rule. The page's unlayered class rules and element rules differ only in
specificity and source order. Blocking `button:hover` (0,1,1) would also
outweigh `.hotkey-opener` (0,1,0).

On a page without a look, tokens used without a fallback drop out:
`color: var(--look-fg)` inherits the page's colour, the card's shadow
disappears, and each line falls back to a hairline. A `max-content`
width with `aspect-ratio: 1` keeps the `?` square at whatever height the
look gives its buttons, even in a stretching flex column.

## How it was verified

- A new browser case, `a page's element rules don't reach the sheet…`,
publishes a page with unlayered `kbd`, `button` and `dialog` rules,
longer ones such as `html body main button`, `body dialog` and `@media
(min-width: 0px) { html body kbd { display: none } }`, a `body *` rule,
a Tailwind-style `@layer base` preflight on `kbd` and `button`,
`direction: rtl` on `kbd`, plus a one-class `.hotkey-key` rule, all in
`<head>` before the sheet mounts. After it mounts, the page prepends a
`.hotkey-key` rule ahead of the reset; opening the sheet moves the reset
back first, and that rule wins. The page then adds `html body dialog div
div section ul li span kbd`, one weighing twenty element names, and a
rule in the existing `base` layer. The keycaps stay visible, opaque, in
the page's font and left-to-right, and the close button isn't
uppercased. No element of the sheet or its button takes the `body *`
rule, while `main` does. A one-class rule for every rendered `hotkey-*`
class, added after the reset, reaches every part. Without a look it
checks that the keycaps keep their size, the close button its padding
and the dialog its border, and that the class rule still colours the
keycaps. It also checks the page's font and colour, the 1px frame, no
shadow, and a hover on the `?`. It then adds a look and checks that the
`?` is 48×48, takes the look's resting and hover backgrounds, and that
the sheet takes the look's 2px frame and offset shadow.
- `pnpm exec playwright test -c playwright.tier1.config.ts
--project=chromium test/browser-tier1/hotkeys.spec.ts`: 5 passed at the
stack's head (`09e9a6e`, #1181), which carries this PR's case unchanged.
The screenshots above were re-shot at this head and came out
byte-identical.
- Locally: format, lint, `pnpm typecheck`, `pnpm typecheck:tests`, and
the hotkeys and SDK skill tests (`hotkeys.test.ts`,
`hotkeySheet.test.ts`, `hotkeyRules.test.ts`, `SdkApi.test.ts`), all
passing. No full `pnpm verify` ran locally: the machine is shared and
heavily loaded, so CI's full suite is the judge.
- The `?` measured square in a flex column, a flex row and a block, with
no look (36px), the Patchy look (44px) and a look whose buttons are 32px
high.

The README's sheet paragraph, the `HotkeySheet` doc comment and the
`patchy-hotkeys` skill now describe the styling.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Patch-side SDK styling. A patch picks it up when it is rebuilt against a
release that carries it, and its `?` button then looks like the look's
buttons. Its own rules aimed at `hotkey-*` classes keep working.

- **What does a revert leave behind?** Nothing on the server. Patches
built with this release keep these styles in their bundle until they are
rebuilt.
- **Does the release before it still work with that?** Yes. No schema,
API or server change.

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]>
Base automatically changed from fix/hotkey-sheet-page-styles to main November 4, 2026 02:18
…pens it from a page's control

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the feat/hotkey-sheet-group-and-open branch from 391fec5 to 9e62e67 Compare November 4, 2026 02:18
@allisonmahmood
allisonmahmood merged commit da9a156 into main Nov 4, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the feat/hotkey-sheet-group-and-open branch November 4, 2026 02:31
allisonmahmood added a commit that referenced this pull request Nov 4, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HotkeySheet: its own row can't be grouped, and nothing else can open it

1 participant