Skip to content

fix(sdk): a page's element rules no longer restyle HotkeySheet, and it finishes without a look - #1180

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

allisonmahmood merged 1 commit into
mainfrom
fix/hotkey-sheet-page-styles

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

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 After: the sheet without a look
Before: the ? button, hovered After: the ? button, hovered

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 After: the ? button in the Patchy look

After: the sheet in the Patchy look

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, feat(sdk): HotkeySheet's own row takes a group, and openHotkeySheet opens it from a page's control #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
  • 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.

@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 the head of the stacked #1181, which carries this PR's new case unchanged (#1181 only edits the sheet-listing test and adds a step):

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

✓ 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

@allisonmahmood
allisonmahmood force-pushed the fix/hotkey-sheet-page-styles branch from 6509a1f to eb86790 Compare November 1, 2026 17:02
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Re-check (GPT 6.1 Sol, xhigh) on 37ec16a: FAIL, one P2. The reset weighs (0,0,9), so a ten-element selector such as html body dialog div div section ul li span kbd still beats it and hides the keycaps.

Next: weight each reset rule as a single hotkey-* class, at (0,1,0), in an unlayered stylesheet placed first in <head>.

  • No element-only rule of any length can win against it.
  • The patch's own class rules still win, by source order or by weight.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Re-check (GPT 6.1 Sol, xhigh) on 8cf7bac: FAIL. Unlayered element rules of any length are now blocked, and every hotkey-* class still takes a one-class override. Remaining:

  • P2: layered element rules reach through revert-layer. This includes Tailwind-style @layer base preflight.
  • P2: a stylesheet prepended to <head> after the sheet mounts beats a patch's one-class override.
  • P3: all doesn't cover direction and unicode-bidi.

Next, the last round on this PR:

  • the sheet's own layer resets its parts with all: revert;
  • the reset goes back to the front of <head> each time the sheet opens;
  • the bidi properties follow the container;
  • the docs state the exact contract, listing layers declared after the first mount as a limit.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Final re-check (GPT 6.1 Sol, xhigh) on 5a50bb7: one P3 left, being fixed. The bidi reset skips the dialog element itself, so on an RTL page a dialog { direction: ltr } rule would reverse the layout. The dialog is joining the reset.

Verified within the stated contract:

  • earlier-layer rules, before and after mount, including Tailwind-style base;
  • a stylesheet prepended after mount;
  • keycap bidi;
  • all 14 rendered hotkey-* classes;
  • look tokens, focus rings, the opener's look styles, keycaps and the no-look defaults.

The browser case fails at 8cf7bac.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol's last P3 is fixed in 5f05bf1. The bidi reset now includes .hotkey-sheet-dialog itself. The browser case runs on a right-to-left page and checks that a page's dialog and kbd rules can't turn either one left to right. I reviewed the diff: it's the one selector plus the test. The hotkeys spec passes 5 of 5 at the top of the stack.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

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

I published seven tier 1 patches from the environment's CLI. Each one went up twice: once built against this head's release, and once against the base's patchy/hotkeys bundle. I opened all of them as Ada in Chromium, at 1280 and 390 wide, and read the computed styles of the sheet and its ? button.

Done means

  • Element rules such as kbd, button and dialog no longer change the sheet or its button, and hotkey-* rules still restyle them: passed.
    • Plain page, no look. Its CSS has kbd as 10px dark caps, button as an uppercase green pill, dialog with a 3px red frame on yellow, an uppercase red h2 and padded ul.
      • Before, all of these reached the sheet: the title was 35px, uppercase and red, the close button was a green pill, the keycaps were 10px, and the dialog was yellow with a red frame.
      • After, none of them do: the keycaps are 12.16px, the close button is transparent, and the dialog border is 0.
    • The issue's container rule. A look page carries @container (max-width: 1060px) { kbd { display: none } }. At 390 wide, every keycap in the sheet was display: none before. After, they all show (image 3).
    • Real Tailwind 4.3.3 output (@layer theme, base, components, utilities). Before, the preflight reached the sheet: its h1–h6 { font-weight: inherit } set the title to weight 450. After, the preflight doesn't reach it and the title is weight 800.
    • A patch restyling the sheet through its classes. It sets .hotkey-opener, .hotkey-opener:hover, .hotkey-sheet-dialog, .hotkey-sheet, .hotkey-sheet-head h2, .hotkey-sheet-close:hover, .hotkey-group h3, .hotkey-row, .hotkey-label, .hotkey-key and .hotkey-then. Every rule applies, as it did before. .hotkey-key now reaches the keycaps too; the base gave them no class.
    • Right-to-left page (<html dir="rtl">), whose own CSS sets dialog { direction: ltr } and kbd { direction: ltr }. Before, the sheet laid out left to right. After, the dialog, the sheet and the keycaps are all rtl (image 4).
  • Without a look, the sheet and button take the page's font and text colour, with a hairline frame and no offset shadow: passed.
    • On the plain page, the sheet, title, labels, keycaps and ? are all in Georgia serif and rgb(43, 45, 66). The sheet has a 1px border and box-shadow: none.
    • The Tailwind page without a look does the same with its sans stack.
    • The PR carries before and after screenshots.
  • The ? has a hover state, and with a look it follows the look's control size and hover: passed, with one exception (note 1). See image 1.
    • No look: 36×36, with a hover tint.
    • Patchy look: 44×44 in the look's blue, darker on hover.
    • A look with 32px buttons (the linear fixture): 32×32, with that look's hover.
  • Focus rings are unchanged. Opening the sheet with ? focuses its close button, which shows the look's 3px ring, or the browser's ring without a look, as before.
  1. The ? button, before and after, on five pages:

The ? button before and after on five pages

  1. The plain page without a look:

The sheet on a page with its own element CSS and no look, before and after

  1. The container rule at 390 wide:

At 390 wide, a container rule hid every keycap before

  1. The right-to-left page:

The right-to-left page, before and after

Golden journeys

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

Rollback answers: they match the diff. The change is SDK styling plus one class on the keycaps. It has no schema, API, CLI or server change, and published bundles keep their styles.

Not run

  • The hotkeys browser spec locally: CI's browser job passed on this head, along with all 23 checks.
  • Tailwind v4 straight from its compiler: patchy publish refuses it (note 3). The Tailwind patches publish Tailwind 4.3.3's compiled CSS with two @supports fallback blocks removed.

Notes

  1. A page's layered reset after the look strips the ?. Take a page that keeps the starter's look.css import and then loads Tailwind v4, so its @layer base is declared after @layer look.
    • There the ? becomes a bare glyph, with no frame, no background and no hover (bottom row of image 1). Before, it was the framed sheet button.
    • This follows the documented contract: the button takes the page's layered styles, as the page's own buttons do, and this page's plain <button> is bare too. The patchy-look skill also says to write CSS outside any layer.
    • The PR's browser case doesn't cover this layer order. There, base comes before look, because the look is added after the sheet mounts. If Tailwind v4 pages are expected, this needs a test case or a sentence in the skill.
  2. With the Patchy look, the ? is a second blue primary next to the page's own primary (third row of image 1). The PR body flags this as the call to check, and it's Allison's call.
  3. Outside this PR: patchy publish refuses Tailwind v4's compiled CSS with "Could not inspect the HTML bundle". The cause is css-tree 3.2.1, which rejects @supports conditions with nested parentheses, such as @supports (((-webkit-hyphens:none)) and …). That blocks every Tailwind v4 page today, which also limits how often note 1 can happen.

@allisonmahmood
allisonmahmood force-pushed the fix/hotkey-sheet-hidden-container branch from a55c6ee to b344013 Compare November 4, 2026 01:54
Base automatically changed from fix/hotkey-sheet-hidden-container to main November 4, 2026 02:05
…t finishes without a look

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the fix/hotkey-sheet-page-styles branch from 5f05bf1 to 4fd1683 Compare November 4, 2026 02:06
@allisonmahmood
allisonmahmood merged commit 435732f into main Nov 4, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the fix/hotkey-sheet-page-styles branch November 4, 2026 02:18
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: a page's generic element rules restyle it, and its defaults look unfinished without the company look

1 participant