Repository navigation
fix(serving): a patch gets the keyboard when it opens - #1097
Conversation
Sol reviewNo merge-blocking findings. Standards: No UI consistency findings. The change preserves focused shell controls and the frame's existing accessible name and keyboard navigation. No method or YAGNI blockers: the guarded focus call is the smallest change described by the issue. Spec: Matches #1087 and its scope within #1086. Focus moves only on the initial frame load when the shell has no focused control. The existing one-shot guard prevents another handoff on a second frame load; route changes do not use this path. Tier 2's starting cover retains its existing focus handoff in Validation: All three tests in The call focuses the iframe rather than a text field; it adds no request to open a phone keyboard. Physical-phone behavior and screen-reader output were not tested. Reviewed against |
c5a0469 to
1b2ff25
Compare
Acceptance: PASS with notesChecked I brought up
The third, Done means
Driver output, Chromium (Firefox matches except the two lines in the first note)Risks beyond Done means
Golden journeys
Rollback answers: they match the diff. The PR changes the shell's CI
Not run
Notes
|
Keys go to the focused document, and the shell kept focus after a patch's frame loaded, so nothing in the patch heard a key until a click. The frame's load handler now focuses the frame unless the shell's own UI holds focus. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1b2ff25 to
1ab59e7
Compare
## What changed This adds release 32's What's new entry, written from `58d94b3`. It covers everything merged since release 31's `through` (`5888411`). It also sets the `patchy` release to `0.32.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | Fixed: a patch has the keyboard as soon as it opens, so its shortcuts work, and Space and Page Down scroll it, without a click first | #1097 | | Improved: agents give a patch pages of its own, each view at its own address under the patch, with back and forward working; repos pick it up at their next refresh | #1095 | | Fixed: a patch that hits Pidgeon's hold on a new message is told nothing was sent and to reply in the conversation, not to wait and retry | #1139 | | Behind the scenes: refresh and `patchy dev` keep working when a repo holds a skill the instance's release doesn't ship, so a rollback can't break them | #1099 | #1138 is a live test tier change with nothing that ships. #1140 is release 31's own entry. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `9e176cb` (release 31) to `58d94b3`:** #1138, #1139, #1097, #1095 and #1099. None is labelled `one-way`, and their Release impact answers agree: - #1097 changes only the shell's script. - #1095 changes only skill text. - #1139 adds a `details.limit` value and a `details.message` on an existing refusal. - #1099 adds no skill, so a repo refreshed on this release holds only skills release 31 also ships. - #1138 is tests only. - **#1099 has to be live before #1092 (PR #1098, `patchy/hotkeys`) ships.** That's why this release goes out alone. Once #1098 is live, a rollback to release 32 or later keeps refresh and dev working for repos that picked up the new `patchy-hotkeys` skill. **Rollback line:** If this release misbehaves, roll back to `9e176cb` (release 31). ## 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.** - #1097, #1095 and #1099 were each reviewed by GPT 6.1 Sol, with every finding resolved. Each got a fresh acceptance PASS with notes after its rebase onto Preact 11. - Each landed with all 12 required checks green on its final head. - #1138 and #1139 were merged from their own thread. - **Deploy state.** The live commit, pinned from `/healthz/deep`, is `9e176cb` (release 31). 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.32.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 A patch is on screen and listening before its frame's load event, which waits for the page's last subresource. The shell only gave the frame focus in that load event, so a key pressed in between went to the shell and the patch never saw it. Now the shell focuses the frame as it starts loading the patch, so the first key pressed once the patch is listening reaches it, with no click. Focus on the shell's own UI, such as the starting cover, still stays where it is. Closes #1171 ## Look at - `packages/serving/src/broker.ts`: one guarded `handOffKeys()` runs just before `frame.src` is set, and again in the load listener. The guard is unchanged from #1097: it moves focus only when `document.activeElement` is `null` or `body`. The load call stays for the case where focus falls back to the shell's body while the frame loads. - `test/browser-tier1/focus.spec.ts`, new case "a key pressed before the frame's load event still reaches the patch". It opens the gap without relying on timing. An init script stops the frame's load event from reaching the shell's listeners, so the patch is up and listening and the shell never runs its load handoff. A key pressed then must reach the patch. Red on main, green here: ``` main's broker (Chromium) ✘ a key pressed before the frame's load event still reaches the patch Expected: "1" Received: "0" this branch (Chromium) ✓ a patch hears the keyboard once its frame loads (1.3s) ✓ a key pressed before the frame's load event still reaches the patch (1.2s) ✓ shell UI that holds focus before the frame loads keeps it (1.1s) ✓ a tier 2 patch hears the keyboard on load and again once its starting cover clears (2.1s) this branch (Firefox, local config) ✓ a patch hears the keyboard once its frame loads (5.7s) ✓ a key pressed before the frame's load event still reaches the patch (2.3s) ✓ shell UI that holds focus before the frame loads keeps it (2.6s) ✓ a tier 2 patch hears the keyboard on load and again once its starting cover clears (3.2s) ``` Because the new case never lets the shell's load listener run, its pass also shows that focus given to the frame before its document loads survives the frame's navigation in both Chromium and Firefox. ## How it was verified - Done means: - A key pressed with the shell's body focused, once the patch is listening, reaches the patch: the new case, in Chromium and Firefox. - Shell controls and the starting cover keep focus: the two existing cases still pass in both browsers. A stand-in shell button focused before load keeps it. The tier 2 cover takes focus over a loaded frame and hands it back when it clears. - A browser-tier case opens the gap on purpose: the new case. - `pnpm check`, then one `pnpm verify` before CI took over as the judge: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and the whole browser suite pass. `test` and `test (bun)` failed outside serving: the CLI stub-server cases recorded a stray `GET /`, the local port probe that doesn't happen on CI, which also double-counts `GET /` in `RequestEvents`; the rest were 5 s timeouts while other worktrees ran their suites on this machine. - Not checked: WebKit (Safari), because Playwright's WebKit won't launch on this host. Physical keyboards on phones and screen readers. CI's browser suite runs Chromium only; Firefox ran from a local config. ## Release impact Tick exactly one. - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required. It changes only the shell's browser script, served under a digest-named URL: no contract, schema or configuration. - **What does a revert leave behind?** Nothing. A key pressed before the frame's load event is lost again. - **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
A patch's page didn't hear the keyboard when it opened. Focus stayed on Patchy's shell around the frame, so arrow keys, Space to scroll and any shortcut did nothing until the person clicked into the page. Now the shell gives the frame focus when it loads, unless Patchy's own UI, such as the starting cover, already holds it.
Closes #1087
Look at
packages/serving/src/broker.ts: the frame'sloadhandler focuses the frame whendocument.activeElementisnullorbody. This covers every scripted frame. Since the tier fold, stored static pages are tier 1 too, so they also get the keyboard on load: Space and PageDown scroll them without a click. The broker is one-shot, so a second load of the same frame stops it before this line runs.stream-status.ts:clearStartingfocuses the frame when the cover closes. This PR adds no second handoff; the new spec checks the two together.test/browser-tier1/focus.spec.ts, red on main and green here:The middle test passes on main because main never moves focus. With the guard removed, so the frame is always focused, it fails on the shell's button:
Expected: focused, Received: inactive.How it was verified
pnpm verify: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and the whole browser suite (77 specs) pass.testhad 19 failures, none in serving:GET /, a local port probe that doesn't happen on CI.RequestEventscounted one route twice once. It passed five runs in a row after that.LocalTaskProviderfailed under load and passes on its own.Release impact
Tick exactly one.
Breaking — requires action from anyone already running this
Not breaking — no action required. It changes only the shell's script: no contract, schema or configuration.
What does a revert leave behind? Nothing. Patches wait for a click again.
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.