Repository navigation
fix(sdk): Tab stays inside a patch's open plain modal dialog - #1420
Conversation
90f4f7c to
9a9f2d8
Compare
9a9f2d8 to
87129a3
Compare
showModal() makes only the patch's own page inert, not Patchy's page around its frame, so Tab past a modal dialog's last control, or Shift+Tab before its first, moved focus out of the frame, and Escape could stop closing the dialog. A small helper in patchy wraps only in a plain dialog and leaves every other Tab to the browser. A dialog is plain when every element in it is an ordinary container or text, drawing-only SVG, or a control Tab stops on once, with no popover, scrolling region, display: contents, reading-flow, CSS-inert content, shadow root, custom element, positive tabindex, option tabindex, textarea, radio, editable content or details without its own summary, while no popover is open in the page. There, on a Tab nothing on the page took, from the last stop of the modal dialog focus is in, it focuses the first, and back for Shift+Tab. It decides last of the key's listeners, and uses no timers. patchy/preact, the generated client and HotkeySheet install it; HotkeySheet keeps its own Tab handler, which holds while it scrolls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
87129a3 to
9a73b37
Compare
|
Review (GPT 6.1 Sol), rounds 1 to 6.
Round 6 checked:
Dismissed, with reasons in the body:
|
Acceptance: PASS with notesChecked How: I built four real tier 1 repo patches with
The plain form dialog holds a text input, a select, a checkbox, Cancel and Save. The Patchy control beside the frame is a real download card, from What acceptance asked
Golden journeys
Rollback answers: they match the diff.
Not run
Notes
Commands as run (trimmed)git fetch origin main pull/1420/head && git checkout --detach 9a73b37 && pnpm install --frozen-lockfile
PATH=<node 24 bin, npm 11.19>:$PATH bun --conditions=development scripts/dev/src/main.ts up team
# in <env>/workspace, as env -u PATCHY_API_URL -u PATCHY_API_TOKEN PATCHY_STATE_DIR=<env>/cli-state <env>/bin/patchy …
patchy init dialogs-plain --tier 1 --purpose "…" --json # {"ok":true,"release":"0.41.0","tier":1,…}
patchy init dialogs-preact --tier 1 --purpose "…" --json
pnpm typecheck && pnpm build && patchy publish --json # dialogs-plain, dialogs-preact: {"ok":true,"versionNumber":1,…}
# main's SDK
git worktree add --detach <scratch>/main df0f62e && pnpm install --frozen-lockfile && pnpm --filter patchy build
# copies of both repos: main's tarball unpacked as node_modules/patchy, main's generateClient() as patchy/_generated/client.ts
grep -c keepTabInModals node_modules/patchy/dist/*.js # 0 files
patchy publish --json # dialogs-plain-main fcaa2b5c… = local build; dialogs-preact-main 0d74ff03… = local build
ACC_ORIGIN=<env> pnpm exec playwright test -c .local/acc1420/playwright.acc.config.ts --max-failures=0
# 27 passed (31.7s) [chromium, headless-shell, firefox × 9]
# probes: 6 passed, Firefox click probe: 1 passed
bun --conditions=development scripts/dev/src/main.ts down
pnpm exec playwright test -c playwright.tier1.config.ts --project=chromium --repeat-each=3 test/browser-tier1/focus.spec.ts
# 30 passed (1.6m)
PATCHY_TIER1_SKIP_BUILD=1 pnpm exec playwright test -c playwright.tier1.config.ts --project=firefox --repeat-each=3 test/browser-tier1/focus.spec.ts
# 30 passed (1.7m)Every trace line, three browsers |
…ey shortcuts (#1421) ## What changed This adds release 42's What's new entry, written from `1cd6d12`. It covers everything merged since release 41's `through` (`a25a9c5`), and sets the `patchy` release to `0.42.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | New: Tell Patchy what it's missing | #1217, #1218, #1219, #1227, #1228 | | New: Turn off single-key shortcuts | #1276, #1279, #1301 | | Fixed: Typing reaches the patch again | #1407, #1412 | | Fixed: Dialogs in patches keep your place | #1420, #1255 | | Behind the scenes: plainer facts for agents building patches | #1249, #1256, #1297, #1418 | | Behind the scenes: Patchy stores teams and audiences ahead of teams | #1416 | | Patch changes: Mod+/ and `client.close()` in patchy/hotkeys; single-key shortcuts can be off; Tab wraps in plain modal dialogs | #1279, #1301, #1420 | #1376 is release 41's own entry. #1400, #1406, #1414, #1415, #1302, #1413 and #1419 are test, CI and dev tooling and need no line. The teams bridge (#1416) ships alone in this release so teams (#1417) can follow in the next one with a release to roll back to that reads its data closed. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `7f93b91` (release 41) to this PR's merge.** No PR in the range is labelled `one-way`, and every Release impact answer says release 41 still works: - **#1217** adds migration `0037_feedback`, a schema release 41 never reads. **#1227** and **#1228** write into it. - **#1276** adds migration `0038_single_key_shortcuts`, a column with a default that release 41 never selects. - **#1416** adds migrations `0039_company_teams` to `0041_connection_audiences`, which hold tables that stay empty until teams ship, and widens one scope check. Its CI rehearsal ran `7f93b91 → head → 7f93b91 → head` on one set of data, and all four steps passed. - **#1279**, **#1301**, **#1255** and **#1420** change the SDK and the shell. Patches built on this release carry a `shortcutSetting` manifest field that release 41 reads without refusing, and its shell names no frame, so every shortcut stays on. - **#1218** and **#1219** add CLI commands and an optional `feedbackHint` in `--json` failures. A CLI from this release refuses to publish to an older instance before sending anything, as any mismatched release does. - Everything else is skill text, docs, tests and CI. If this release misbehaves, roll back to `7f93b91` (release 41). Written by Claude Opus 5.5 in Claude Code, through T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
…1505) ## What changed Patchy said desktop Safari was untested. Running the whole tier 1 browser suite in WebKit on macOS, and the bugs it pointed at in real Safari 27.2, found two real bugs, fixed here: - **Option+Tab left a patch's open dialog, and Escape then stopped closing it.** On a Mac, Option+Tab is how Safari reaches buttons, checkboxes and links. The SDK's Tab helper from #1420 skipped any Tab with Option held, so Option+Tab past a plain modal dialog's last control went out to Patchy's page around the patch. Chrome on a Mac did the same. - **Tell Patchy lost focus after the switcher.** With its panel open, ⌘⇧K then Escape left focus on nothing instead of the Tell Patchy button. Every tier 1 browser spec now runs in WebKit on macOS as its own CI job, `browser-webkit`. It isn't a required check. The docs now say desktop Chromium-based browsers, Firefox and Safari are supported, and mobile is outside this release. ## Look at **1. The dialog fix** (`packages/patchy/src/modalTab.ts`). In Safari and Chromium on a desktop Mac, the helper treats Option+Tab as a Tab. Nothing else changes: - **It still counts every control as a stop.** That is how Option+Tab moves under Safari's defaults, and how Chrome's Tab and Option+Tab both move on a Mac. - **Plain Tab is handled as before.** The helper decides only a dialog's ends, by the stops it counts, as #1420 left it; between them the browser moves focus its own way. Under Safari's defaults plain Tab stops on fewer controls: from a stop that is also the dialog's last as the helper counts, the helper wraps it, and from an earlier one Safari goes round Patchy's page, which holds none of its stops, and lands back on the dialog. Real Safari did that before this change and still does. - **It holds under Safari's and macOS's default keyboard settings**, which a page can't read. With Safari's "Press Tab to highlight each item" or macOS's Keyboard navigation turned on, the browser stops on a different set of controls, and Tab or Option+Tab can still leave past one it skips. The SDK README, the hotkeys skill, the module's comment and the release note say so. - **It applies only where the browser moves focus by Option+Tab.** I checked how Option+Tab moves focus on each: Chromium and Firefox on Linux, and Chromium, Firefox and WebKit on macOS. Firefox ignores it on a Mac, and every browser ignores Alt+Tab elsewhere, where it's the system's window switcher. So `movesByOptionTab` asks for a desktop Mac, not in Firefox. The platform must start with "Mac" (`userAgentData.platform` where Chromium has it, else `navigator.platform`), and a touch device doesn't count: an iPad asking for desktop pages says "MacIntel" but reports touch points. This is narrower than the Mac that TanStack Hotkeys and the switcher read Mod from. Their check also takes an iPhone, whose agent says "like Mac OS X", which is right for ⌘ but not for this key. `modalTab.test.ts` covers Safari, Chrome, Edge and Firefox on a Mac, an iPad asking for desktop pages, an iPhone, Chrome on Linux with and without a Mac's agent, and Chrome on Windows. Chromium and Firefox on Linux and Windows behave exactly as before. Walks in **real Safari 27.2** over safaridriver, using `focus.spec`'s "New task" dialog with stand-in Patchy buttons `shell-before` and `shell-after` around the frame. "task" is the dialog element itself. | Key | Before | After | | --- | --- | --- | | Option+Tab | title → … → close → **shell-after**: Escape there doesn't close it | title → … → close → title | | Option+Shift+Tab | title → task → **shell-before** → shell-after → close … | title → close → discard … | | Tab | title → priority → task → title | same | | Shift+Tab | title → close → priority → title | same | Playwright's WebKit walks Option+Tab the same way. Plain Tab goes round there too, but stops for one press outside the page on the way, where real Safari doesn't. So CI asserts the Option+Tab walks, and plain Tab was checked in real Safari. Chromium on a Mac had the same Option+Tab leak, which this fixes: ``` before Alt+Tab … close → shell:shell-after → shell:BODY → shell:shell-before | Escape closes it: false after Alt+Tab … close → title → priority → urgent | Escape closes it: true ``` `focus.spec`'s two dialog tests now press Option+Tab in WebKit. Both fail in WebKit with main's helper, at the wrap after Close, and pass with this one: ``` ✘ [webkit] focus.spec.ts:720 › Tab stays inside a modal dialog of a page on the generated client … Locator: locator('#patch').contentFrame().locator('#title') Expected: focused Received: inactive ✘ [webkit] focus.spec.ts:1035 › Tab stays inside a modal dialog of a Preact page … (same) ``` **2. Tell Patchy** (`packages/portal/src/FeedbackPages.ts`). When the switcher's `showModal()` hides the panel, WebKit fires no `toggle` event for the panel. So the panel never ran its close steps, and never handed focus back. The script now remembers whether the panel is open. A close now has two parts: settling what was in flight, then giving focus back. Chromium and Firefox still get their `toggle` and take the same path as before. In WebKit: - **The switcher's close settles the panel**, then gives focus back only if focus is lost. The switcher is already gone and no tap needs checking, so this close doesn't wait for the switcher or arm the one-second click check. Before, a switcher opened while focus was outside the open panel left the script waiting, and a later switcher close took focus to Tell Patchy. - **An answer that lands while the switcher covers the panel is held.** It isn't drawn into the hidden panel. The switcher's close then settles it, as every close does: the panel opens again with the draft and the "couldn't confirm" note, as in Chromium and Firefox. Before, the receipt went into the hidden panel, and the close then wiped it with the draft. In real Safari, focus after Escape was `BODY` before and is the Tell Patchy button after. `tell-patchy.spec.ts:49` fails in WebKit on main and passes here. The two new tests fail in WebKit with the first commit's script and pass in all three browsers here: ``` ✘ [webkit] tell-patchy.spec.ts › a send answered while the switcher is open opens again with the draft kept and the note Error: expect(locator).toBeVisible() failed Expected: visible Error: element(s) not found ✘ [webkit] tell-patchy.spec.ts › a switcher opened from outside the open panel leaves the next switcher's focus alone Error: expect(locator).toBeFocused() failed Expected: focused Received: inactive ``` **3. The CI job.** `browser-webkit` runs on `macos-15`, a standard GitHub-hosted arm64 runner. Like `browser-firefox`, it installs only its browser, builds what it runs and shares nothing. Nothing `needs:` it, it has no `continue-on-error`, and no ruleset changed. A failure shows red on the PR and on `main` without blocking a merge. - **Why macOS:** Linux WebKit's network stack never notices a dropped HTTP/2 stream, so live updates hang there. macOS WebKit and Safari notice and reconnect. The `webkit` project exists only on macOS. - **`pnpm verify`:** it leaves WebKit out, since the job isn't required and Linux WebKit isn't Safari. On a Mac, `pnpm test:browser:webkit` runs it. - **Timeout:** 40 minutes. A full run took 7 to 13 minutes on an Apple-silicon Mac on macOS 27, depending on load, and a hosted runner is slower. - **The Playwright action:** caches under macOS's `~/Library/Caches`. - **The shell's broker** and core's scripts name Safari 16.4 among their esbuild targets, the oldest Safari that parses the lookbehind regular expression in the shared schemas the broker bundles. Those are syntax targets: esbuild lowers syntax, never runtime APIs, and what the shell and the SDK call, such as `Promise.withResolvers`, already asks for current browsers, Safari 17.4 and later, as it does of Chrome and Firefox. Neither output changes: the broker's is byte for byte what `main` builds, and core's is the same as it was for Safari 16. **4. What the WebKit failures on main were.** On `main` as it was, the suite gave 150 passed, 37 failed and 3 skipped in WebKit on macOS. Every failure but the two fixed above was a test assuming Chromium or Linux: | Test | What it was | What changed | | --- | --- | --- | | `fixtures.ts` `prepare` | Playwright's WebKit routes `blob:` and `data:` through `context.route`, which aborted them | they continue | | `fixtures.ts` page `goto` | WebKit fires the shell's `load` before its frame's | in WebKit, a `goto` also waits for the frame `iframe#patch` holds to load its `/~content/` page, and fails when it stalls in place or the page closes or crashes. It waits for the shell `goto` loaded and no further: a page without that frame returns at once, as does one whose shell takes the frame away for a notice or a fresh load. A test that needs the next shell's patch waits for it, as `tier1.spec`'s reload test does | | `focus.spec`, `look-preview.spec`, the sheet's steps in `hotkeys.spec` | macOS Tab skips buttons, checkboxes and links | a `tab` helper presses Option+Tab in WebKit | | `focus.spec` click on a shell button, `hotkeys.spec` opener, menu item and dialog button | Safari focuses no button a click presses | in WebKit, the frame loses focus or focus goes back to the page's body; the popover invoker is opened from the keyboard | | `hotkeys.spec`, `shortcut-setting.spec`, `tier1.spec` paste | literal `Control+…` and "Ctrl" labels; on a Mac Mod is ⌘ | `ControlOrMeta`, and labels from the platform: `⌘ /`, `⇥ A` | | `hotkeys.spec` field keys | ⌘Z undoes the page's last typing, which WebKit runs together across fields, and focuses the field it undid | in WebKit, focus goes back to the field after ⌘Z | | `hotkeys.spec` rich text | End on a Mac scrolls | ⌘→ on a Mac | | `downloads.spec`, `server-subscriptions.spec` | macOS reports download names decomposed (NFD) | compares `normalize()`d names | | `ui.spec` history at its longest | WebKit keeps 100 entries, not 50, and refuses more than 100 `pushState` calls in 10 s; Firefox trims only after the task | pushes ten at a time until ten that all went in leave the count where it was; then checks each redraw took an entry of its own, so the close needs its keep-closing step, except in Firefox, which replaces the entry | | `ui.spec` pressed submit | Playwright's WebKit can't fulfil a route with a 303 | in WebKit the post gets the page itself | | `ui.spec` forced colours | Playwright's WebKit can't emulate forced colours | skipped in WebKit, with that reason | | `starting.spec` fleet retry, idle documents | `LocalTaskProvider` refuses to start off Linux, in every browser | Linux only, with that reason | | `tier1.spec` forced download | with `download` stripped, WebKit shows the uploaded HTML as a `blob:` document in the shell's origin, and the inherited CSP refuses its script | in a page of its own. Chromium and Firefox must still download it, with the attribute really stripped and the page where it was. WebKit must show the bytes with no mark from the script, which marks the document first, and no request to `example.invalid` | | `sharing.spec` share dialog Back and Forward | under load, WebKit showed two races in the test: Back before the redrawn dialog's deferred script ran stayed on its first entry, and Forward before the list's `pageshow` gave focus back closed the dialog again | opening Share and submitting the invite go through `loadDialog`, which waits for the dialog page's deferred script, and, where Back passes through the dialog's first entry, the test waits for focus back on the menu's button before Forward | | `tier1.spec` embed refusal | WebKit leaves a refused frame at its address, holding an empty document | in WebKit, a frame at that address holds no element, text or title; Chromium and Firefox still have no frame there | The six WebKit skips are the three Firefox also skips (a touch drag, BFCache, tab-and-back), the two Linux-only fleet tests, and forced colours. Steps that drive Chromium's DevTools protocol skip in WebKit as they do in Firefox. ## How it was verified - **WebKit**, the whole suite on an Apple-silicon Mac on macOS 27, Playwright WebKit 27.2. At the second commit: 186 passed, 6 skipped, 0 failed and nothing retried, in 8.2 minutes; the first commit gave 184, and the two new Tell Patchy tests are the difference. At this head: 185 passed and 6 skipped in 7.5 minutes, and one test failed before it began, when its tier 1 server found its port taken as it started (the free-port pick races, as it did once in the second round too); `stream.spec` rerun alone passed, 31 of 31. CI's `browser-webkit` is the full run on a hosted runner. - **Real Safari 27.2** over safaridriver, at the first commit: the walks above, before and after, and Tell Patchy's focus after the switcher. The follow-up's Tell Patchy changes ran in Playwright's WebKit only. - **Chromium and Firefox**, spec by spec on Linux. At the first commit: `focus`, `hotkeys`, `shortcut-setting`, `look-preview`, `downloads`, `tier1`, `ui`, `server-subscriptions`, `tell-patchy` and `starting`. At this head: `tell-patchy`, `tier1`, `hotkeys`, `ui` and `focus` in both, all passing. CI's `browser` and `browser-firefox` are the full runs. - **Checks:** `pnpm format:check`, `pnpm lint`, `pnpm typecheck` and `typecheck:tests`, plus the unit tests beside the changed code: `modalTab.test.ts` (new), `client.test.ts`, `hotkeys.test.ts`, `key.test.ts`, `FeedbackPages.test.ts`, `html.test.ts`, `SdkApi.test.ts`, and serving's `Pages.test.ts` and the CLI's `devServer.test.ts` over the rebuilt broker. - **Not run:** `pnpm verify` end to end; mobile Safari; Safari with macOS Keyboard navigation or Safari's "Press Tab to highlight each item" turned on; Firefox on a Mac by hand. - **Review:** GPT-6.2 Sol and Gemini 4 Neon reviewed the first commit. Their findings are fixed in the follow-up commit, with one order dismissed: a click within a second of reopening Tell Patchy after the switcher can't move focus out of the field. Every reopen is itself a click: a mouse click, a tap, or Enter or Space on the button. That click reaches the one-second check first, while focus is still on the opener, and ends the check. A test of that order passed with the first commit's script in Chromium and WebKit, so it wasn't added. The switcher's close no longer arms the check either way. Both re-checked the follow-up. Neon approved, with one nit. Sol asked for four more changes, fixed in the third commit: the Safari keyboard setting above, the Safari 16.4 build floor, WebKit's frame wait following a shell that loads afresh to its next frame (and failing on a closed or crashed page, which also covers Neon's nit), and `pnpm verify`'s wording. Both reviewed the third commit. Neon approved, with two nits; Sol asked for changes, fixed in the fourth commit: the build targets are described as syntax targets, since the shell and the SDK call APIs from Safari 17.4; the keyboard-settings caveat now separates the helper's ends from the browser's own moves and covers macOS's setting too; and `scripts/verify.ts`'s header matches the docs. One finding is dismissed: Sol and Neon found that the third commit's frame wait could still miss a shell that reloads, if the old frame's detach arrives before the new document. The fourth commit drops the reload-following instead of chasing it. The wait bridges WebKit's load order for the shell `goto` loaded; a test that needs a later shell's patch already waits for it itself, as the reload test does. Both approved the fourth commit. The fifth is test-only: `browser-webkit` then failed once on `sharing.spec`'s share dialog, which this PR hadn't touched, and the test failed 3 times in 120 runs under load on the Mac. Both failures were the test acting before the page's own script had run; after the fix it passed 120 of 120 runs under load in WebKit, and the spec passes in Chromium and Firefox. Both approved the fifth commit; the sixth applies Neon's nit, opening Share through `loadDialog` too, and passes 120 of 120 under load in WebKit. Sol and Neon both suggested a separate issue for the two races in the dialog history script itself, which a person on a slow load could meet by pressing Back or Forward at once; that is left out of this PR. **Hit every surface.** These applied: - **The CLI:** `packages/patchy/README.md` and the `patchy-hotkeys` project skill say Option+Tab wraps in Safari and Chromium-based browsers on a Mac, and that Firefox there doesn't move focus by it. - **Product shape:** the browser claim changed in `README.md`, `docs/product.md` and the Preact capability's limits. - **Docs:** `docs/DEVELOPMENT.md` covers the `webkit` project, the job and its runner, and says `pnpm verify` runs the suites CI requires except live Clerk, `server-image` and `rollback-rehearsal`, as `AGENTS.md`, `README.md` and `scripts/verify.ts` do. No wire contract, dev loop, vocabulary, migration, company resource or layout change. **Release note**, the line for the next release's `patchChanges`: > In pages on `patchy/preact` or the generated client, Option+Tab in Safari and Chromium-based browsers on a Mac, Safari's way to reach every control, now wraps inside a plain modal `<dialog>` as Tab does, instead of leaving for Patchy's page, where Escape stopped closing the dialog. That holds under Safari's and macOS's default keyboard settings. Versions already published behave as before until they're built and published again. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required. SDK page behaviour on a Mac, in patches rebuilt on this release; the portal's Tell Patchy script; the shell broker, built for Safari 16.4 too, with output unchanged; CI, tests and docs. No API, schema or CLI contract changes. - **What does a revert leave behind?** Patches built and published while this was in place keep the new helper in their bundles. Nothing on the server. - **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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
A patch's page runs in a frame inside Patchy's page. A
<dialog>opened withshowModal()makes only the patch's own page inert. So Tab past the dialog's last control, or Shift+Tab before its first, moved focus out of the frame onto Patchy's controls or the browser's, and Escape could then stop closing the dialog.Pages built with the SDK now keep Tab inside a plain modal dialog, and leave every richer dialog's Tab to the browser, exactly as it moves today. A small helper in
patchy(packages/patchy/src/modalTab.ts) handles a Tab that nothing on the page took, from the last stop of the plain modal dialog focus is in. It focuses the dialog's first stop, and the reverse for Shift+Tab. A plain dialog with no controls keeps focus.patchy/preact, the generated client andHotkeySheetinstall it once per document. Patchy injects nothing into served pages, so published patches keep the old behaviour until they're rebuilt and published again on the release that ships this.Closes #1263
Look at
What "plain" means (
isPlain, an allowlist). Every element in the dialog must be one of these:div,span,p, headings,label,form, an enabledfieldsetand itslegend, lists, sectioning elements, table elements, inline text tags,br,hr,imgwithoutusemap, and SVG that only draws (noa,use,foreignObjectortabindex);button,a,selectwith options that have notabindex,detailswhose first child is its ownsummary, checkbox and one-line text-likeinputs, and an element withtabindex0 or -1.It must also have none of these, anywhere in the dialog:
popoverattribute, or an open popover anywhere in the page;display: contents, areading-flowother thannormal, orinteractivity: inertthat noinertattribute inside the dialog explains (Chromium draws the attribute asinteractivity: inerttoo, and its subtree is never a stop);tabindex;Anything else makes the dialog not plain, and then the helper does nothing.
Cost. A Tab first checks, with a tree walker, that nothing after the focused element (before it, for Shift+Tab) may take focus. Only at an end does it walk the dialog and read computed styles, so a Tab between stops costs no more than that check.
How it decides, unchanged from the last round.
windowre-appends the deciding listener to the end ofwindow's list, so it runs after every listener already on the key's way, and apreventDefault()from them wins.preventDefault()andfocus()during the keydown. There are no timers, noblurhandling and no retries, and nothing is inserted into the author's dialog. Escape is the browser's.HotkeySheetkeeps its own Tab handler, as on main. Its dialog scrolls once its card outgrows the viewport, which makes it not plain, and its buttons are all it holds. So its own wrap stays sure, and the sheet is never worse than main. The helper sees that handler'spreventDefault()and stays out, and the sheet still installs the helper for the page's other dialogs.Sol's round 3.
popoverattribute, or an open popover anywhere in the page, isn't plaindisplay: contents, and stops inside editable content<area href>imgwithusemapisn't plain, andmapandareaaren't on the listreading-flowThe two dismissals:
shadowRoot, and it takes page code attaching one to adivinside a modal. It's stated in the code.windowfrom a capture listener during the same key's dispatch. That's exotic. There's no cheap exact fix: once the bubble atwindowhas begun, nothing added later in that dispatch can run after it. It's stated in the code.Sol's round 4, four tightenings inside the allowlist:
<details>without an authored<summary>summary<a>in<defs>drawn through<use>a,use,foreignObjector atabindexisn't plaininteractivity: inertinertattribute explains it<option tabindex="0">tabindexisn't plainSoft runs in
chromium(desktop) andfirefox:interactivity, so there the dialog is plain and wraps. Like reading-flow, the step checks for support, and that branch fails on main in Firefox.select multipleshowed its option, which the old end check already saw, so the select case is a dropdown. In the earlier round, the editable case needed the region itself to be no stop while a stop inside it shows.Sol's round 5.
inertancestor outside the modal: a modal dialog escapes its ancestors' inertness. Native Tab from A reaches B in Chromium and Firefox, and both reportinteractivity: autoinside it. The helper usedclosest("[inert]"), found no stops, and cancelled the Tab. It now countsinertonly from the dialog down to the element (isInertIn), for stops and for theinteractivityrule alike.interactivity: inertoutside aninertsubtree.Red and green. Every assertion was made soft for a local run, with base source restored by
git restore --source=<base> -- packages/patchy/src packages/sdk/src/generateClient.ts. The runs were in the headless shell, desktop Chromium (channel: "chromium", now the repo'schromiumproject after #1302) and Firefox.<dialog>The native steps assert that nothing took the Tab, so the browser moves focus as on main. Where the browser has no
reading-flow, as in Firefox, that dialog's order is the page's, so it is plain and wraps; the step checks for that.At head, 9a73b37:
focus.spec.tswith--repeat-each=3inchromiumandfirefox: 60 passed;hotkeys.spec.tsandshortcut-setting.spec.ts: 27 passed.Where it installs.
patchy/preact: the issue namedpreact/runtime.ts, but the repo's lint forbids../imports frompackages/patchy/src/preact/, so the call sits insrc/preact.ts, thepatchy/preactentry. Pages may import only SDK entry points, so every Preact page imports it to render.keepTabInModals()frompatchy/client. Pages reachpatchy/clientonly through the generated client.How it was verified
focus.spec.ts: the three-way comparison above, in the headless shell, desktop Chromium and Firefox (CI's projects, with Fission on).hotkeys.spec.tsandshortcut-setting.spec.tsin thechromiumproject, now desktop Chromium, 27 passed. That includes the sheet's own Tab round its buttons.client.test.tscase per tier checks that the generated client's page bundle carries the helper. Withhotkeys,hotkeySheet,hotkeyRules,devLifecycleandpageImports, 75 passed.pnpm format:check,pnpm lint,pnpm typecheck:tests, and thepatchytypecheck and build.pnpm verifyin full, WebKit, and headful browsers.install.test.ts, which fails on this machine because its sandboxedPATHfinds no npm. It doesn't touch this change.Hit every surface. These applied:
patchy/clientexportskeepTabInModals, and the generated client calls it.packages/patchy/README.mdsays Tab wraps in plain dialogs and richer ones keep the browser's.patchy-hotkeysproject skill, which is release-bound and has no lock hash. Its Native<dialog>section says what counts as plain in a sentence, including that an open popover anywhere in the page turns wrapping off, and drops the rule docs(sdk): a hand-built shortcuts sheet keeps focus inside it #1256 added that told agents to handle Tab themselves.None of the others apply: no wire contract, dev loop, vocabulary, migration or company resource change. Served pages are untouched, since Patchy injects nothing. There are no reverse states and no layout change.
Release note. The line for the next release's
patchChanges:Release impact
SDK page behaviour only, and only in patches rebuilt on this release. Nothing changes on the server or in published versions.
Built by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, through T3 Code.