Skip to content

fix(sdk): HotkeySheet opens in view when its button's container is hidden - #1178

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/hotkey-sheet-hidden-container
Nov 4, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/hotkey-sheet-hidden-container

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What changed

A patch that mounts <HotkeySheet /> in a sidebar hidden at narrow widths got an invisible sheet: ? still opened the modal dialog under the hidden sidebar, so the page went inert with nothing drawn until Escape. The sheet now renders in the page's body, so it opens in view wherever its button is mounted, and one sheet is enough.

Closes #1157

Look at

  • packages/patchy/src/hotkeys.ts: the sheet's HotkeyScope and dialog render through a portal into document.body. The button stays where it is mounted, and the dialog's own focus return is unchanged.
  • The new browser step hides the sheet's sidebar, presses ?, expects the sheet and its rows visible with the close button focused, then Escape returns focus to where it was.

Red on the base (the dialog under the hidden sidebar isn't even exposed as a dialog):

✘ the sheet opens by ? or its button, … › with its button in a hidden sidebar, ? opens it in view, and focus goes back
  Error: expect(locator).toBeVisible() failed
  Locator: locator('#patch').contentFrame().getByRole('dialog', { name: 'Tracker shortcuts' })
  Error: element(s) not found

Green on the head:

✓ 4 [chromium] › test/browser-tier1/hotkeys.spec.ts › the sheet opens by ? or its button, lists by group, holds the page's hotkeys and closes like a dialog
4 passed

How it was verified

  • pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium test/browser-tier1/hotkeys.spec.ts: red on the base, all 4 green on the head. The earlier steps of the sheet test still pass: ? and the button open it, the page's hotkeys wait, Tab stays on the close button, and Escape, the close button and a click outside close it with focus back.
  • pnpm verify at this head: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install and tier2-smoke passed. test, test (bun) and browser failed locally on CLI stub-server request logs and tier 1's foreign-request check. Each failure was a stray GET / that a local tool on this machine sends to open ports, plus two 5-second timeouts under load; reruns failed different cases each time. None of these touch the hotkeys code. The browser suite stops at its first failure, so the hotkeys spec ran separately (above). CI runs them all.

The patchy-hotkeys skill's sheet section now says the sheet opens over the whole page wherever the button is, so a patch mounts it once. It and the README's sheet paragraph also say the dialog renders in the page's <body>, outside the patch's root element. A patch should restyle it with selectors that don't depend on where it's mounted, such as .hotkey-sheet …, and set --look-* overrides on :root or body; a rule such as #app .hotkey-sheet no longer reaches it.

Release impact

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

Patch-side SDK behaviour only; it reaches a patch when the patch is rebuilt against a release that carries it.

  • What does a revert leave behind? Nothing on the server. Patches built with this release keep the portal 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.

@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:s Under 100 changed lines labels Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) on 321bbb3: approve with one P3, being fixed.

  • P3: the dialog now sits outside the patch's root element, so #app .hotkey-sheet or tokens overridden only on an inner element stop applying. The skill and README should say to use global selectors and :root or body tokens.
  • Found sound:
    • the hidden-container case;
    • focus restore, modal inertness and hotkey suppression;
    • unmount removing the dialog and releasing its scope;
    • global CSS overrides and company-look tokens still applying.
  • Tests: the new visibility assertion fails on the base.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked a55c6eead88fc287658a55bc8ea32b9d1cf75b7f (base 1f187a92b2c20da81e8a1d647ea28a60a075d6ef) on team, by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

I tested a real tier 1 patch, published from a team environment at the head. Ada's CLI ran patchy init with a fresh pnpm store, so the installed patchy/hotkeys was the head's packed release, which renders the sheet through createPortal(…, document.body). The patch is a small tracker with a sidebar holding <HotkeySheet title="Tracker shortcuts" />. The patch's own CSS sets the sidebar to display: none under 700px. The patch also has page hotkeys N and G H and a Filter button, and it restyles the sheet with .hotkey-sheet selectors. I drove it as Ben in Chromium at 390px and 1280px, and all 25 checks passed.

Done means

  • ? and the button open a visible sheet wherever the button is mounted, including inside a hidden container: passed. At 390px the sidebar and its ? button are hidden. Pressing ? opens the sheet as a 390×348 card at the bottom of the frame, with its rows (New item, Go home, Show shortcuts) visible. The dialog is a child of the frame's <body> and :modal. At 1280px the ? button shows in the sidebar and clicking it opens the sheet. I also opened the sheet at 1280px and narrowed the window to 390px while it was open, and it stayed in view.
  • Focus goes back on close: passed. Escape, the close button and a click outside each return focus to Filter after a ? open. At 1280px, Escape after a button open returns focus to the ? button. When the sheet opens, the close button has focus.
  • A browser-tier case mounts the sheet in a hidden container and sees it open: passed. I ran hotkeys.spec.ts in this checkout and all 4 tests passed. With the base's hotkeys.ts restored under the new test, it fails at the new step's assertion. The earlier sheet steps still pass on the base.

What else I checked

  • The page's hotkeys wait while the sheet is open: passed. With the sheet open, N and G H leave "Items: 0 / Home visits: 0". After Escape, both fire ("Items: 1 / Home visits: 1").
  • Patch CSS with .hotkey-sheet selectors still restyles it: passed. The patch's CSS gives .hotkey-sheet a computed border of 4px rgb(200, 0, 120) and .hotkey-sheet .hotkey-label a colour of rgb(200, 0, 120). Company look tokens still reach the card: its background comes from --look-surface.
  • Unmounting the sidebar while the sheet is open: passed. The dialog is removed and the scope is released, so N fires again.
  • No page errors.
Driver output, the patch at 390px and 1280px
PASS  narrow 390px: sidebar hidden by the patch's CSS
PASS  narrow 390px: ? button hidden with it
PASS  narrow: ? opens the sheet in view  (card 390x348 at 0,496)
PASS  narrow: card is non-empty and inside the frame
PASS  narrow: rows listed  (New item, Go home, Show shortcuts)
PASS  narrow: close button focused
PASS  dialog renders in the frame's body
PASS  while open: N and G H wait  (Items: 0 / Home visits: 0)
PASS  .hotkey-sheet border from patch CSS  (4px rgb(200, 0, 120))
PASS  .hotkey-sheet .hotkey-label colour from patch CSS  (rgb(200, 0, 120))
PASS  #root-scoped rule no longer reaches it (documented)  (text-decoration-line: none)
PASS  look tokens still apply in body  (--look-surface #fffefa, card bg rgb(255, 254, 250))
PASS  Escape closes it
PASS  Escape: focus back on Filter
PASS  after close: N and G H fire again  (Items: 1 / Home visits: 1)
PASS  close button closes it, focus back on Filter
PASS  click outside closes it, focus back on Filter
PASS  wide 1280px: ? button visible in the sidebar
PASS  wide: button opens it
PASS  wide: Escape returns focus to the ? button
PASS  opened wide, narrowed while open: still in view  (card 390x348)
PASS  narrowed: Escape returns focus to Filter
PASS  sidebar unmounted while open: dialog removed  (0 dialogs left)
PASS  after unmount: page hotkeys fire  (Items: 2)
PASS  no page errors

25/25 passed
The PR's spec: green on the head, red on the base

Head:

✓ 1 … › patchy/hotkeys fires in the published frame across fields, scopes, layouts and a Mac
✓ 2 … › a component's hotkeys are live from the commit that mounts it to the one that removes it
✓ 3 … › a conflict warning waits for every hook's update, so siblings swapping keys don't warn
✓ 4 … › the sheet opens by ? or its button, lists by group, holds the page's hotkeys and closes like a dialog
4 passed (32.7s)

Base hotkeys.ts under the new test:

✘ 1 … › the sheet opens by ? or its button, lists by group, holds the page's hotkeys and closes like a dialog
  Error: expect(locator).toBeVisible() failed
  Locator: locator('#patch').contentFrame().getByRole('dialog', { name: 'Tracker shortcuts' })
  Error: element(s) not found
  > 528 |     await expect(dialog).toBeVisible();
1 failed

Golden journeys

  • None touched. The change is SDK code bundled into patches, and no scenario patch mounts HotkeySheet. Along the way, Ada's CLI published a repo patch and Ben opened it at its address.

Rollback answers: they match the diff. The diff changes the SDK's hotkeys.ts, two docs and a test, with no migration, API, CLI or infrastructure change. After a revert, patches built against this release keep the portal until they are rebuilt, and the release before works with that. No one-way label is needed.

Not run

  • Full pnpm verify and the rest of the browser suite: left to CI as instructed. When I posted, browser, test (22/24/26), cli-smoke, cli-smoke (26), release-tarball and pidgeon-suite were still running on the head. The finished checks had passed.
  • Safari and Firefox: I ran Chromium only, as the tier 1 suite does.

Notes

  • HotkeySheet shipped in release 33. A live patch whose CSS reaches the sheet through its root element (for example #root .hotkey-sheet …) loses those rules on its next refresh. So does one that sets --look-* overrides on an inner element. I confirmed the first case: #root .hotkey-sheet-head h2 { text-decoration: underline } now computes to none. The skill and README now say so. Nothing breaks until a rebuild, and the cost then is cosmetic, so "Not breaking" is a fair call.
  • Screenshots: the patch at 390px with its sidebar hidden, and at 1280px with the ? button in the sidebar. Both have the sheet open with the patch's magenta restyle.

sheet-390-hidden-sidebar

sheet-1280-sidebar

@allisonmahmood
allisonmahmood force-pushed the fix/hotkey-sheet-hidden-container branch from a55c6ee to b344013 Compare November 4, 2026 01:54
@allisonmahmood
allisonmahmood merged commit e42c076 into main Nov 4, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the fix/hotkey-sheet-hidden-container branch November 4, 2026 02:05
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:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HotkeySheet's dialog opens invisibly inside a hidden container

1 participant