Skip to content

fix(sdk): Tab stays inside a patch's open plain modal dialog - #1420

Merged
allisonmahmood merged 1 commit into
mainfrom
t3/sdk-modal-tab-trap
Nov 12, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
t3/sdk-modal-tab-trap

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

What changed

A patch's page runs in a frame inside Patchy's page. A <dialog> opened with showModal() 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 and HotkeySheet install 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:

  • ordinary containers and text: div, span, p, headings, label, form, an enabled fieldset and its legend, lists, sectioning elements, table elements, inline text tags, br, hr, img without usemap, and SVG that only draws (no a, use, foreignObject or tabindex);
  • controls Tab stops on once: button, a, select with options that have no tabindex, details whose first child is its own summary, checkbox and one-line text-like inputs, and an element with tabindex 0 or -1.

It must also have none of these, anywhere in the dialog:

  • a popover attribute, or an open popover anywhere in the page;
  • a computed display: contents, a reading-flow other than normal, or interactivity: inert that no inert attribute inside the dialog explains (Chromium draws the attribute as interactivity: inert too, and its subtree is never a stop);
  • a shadow root or custom element;
  • a dialog or descendant that scrolls;
  • a positive tabindex;
  • editable content, a textarea or a radio.

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.

  • The topmost modal is the one focus is in.
  • It decides last. A capture listener on window re-appends the deciding listener to the end of window's list, so it runs after every listener already on the key's way, and a preventDefault() from them wins.
  • When it wraps, it calls preventDefault() and focus() during the keydown. There are no timers, no blur handling and no retries, and nothing is inserted into the author's dialog. Escape is the browser's.

HotkeySheet keeps 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's preventDefault() and stays out, and the sheet still installs the helper for the page's other dialogs.

Sol's round 3.

Item Now Step
1. Popover any popover attribute, or an open popover anywhere in the page, isn't plain from the control that opened a popover in the dialog
2. display: contents, and stops inside editable content not plain before a shadow host laid out as display: contents; before an editable region with a stop inside that shows
3. A closed root on a standard element dismissed (below)
4. <area href> img with usemap isn't plain, and map and area aren't on the list before an image map's link
5. A scrolling dialog not plain in a dialog that scrolls
6. reading-flow not plain where reading-flow orders the dialog
7. A canceller registered during capture dismissed (below)

The two dismissals:

  • Item 3 can't be detected. A closed root on a standard element exposes no shadowRoot, and it takes page code attaching one to a div inside a modal. It's stated in the code.
  • Item 7 needs a page that registers a bubble listener on window from a capture listener during the same key's dispatch. That's exotic. There's no cheap exact fix: once the bubble at window has 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:

Item Now Step
1. <details> without an authored <summary> plain only when its first child is its own summary before a details element whose summary the browser draws
2. SVG <a> in <defs> drawn through <use> SVG with a, use, foreignObject or a tabindex isn't plain after SVG that draws a link through use
3. CSS interactivity: inert not plain, unless an inert attribute explains it where CSS makes the first control inert
4. <option tabindex="0"> an option or optgroup with a tabindex isn't plain from a select whose option is given a tabindex

Soft runs in chromium (desktop) and firefox:

  • Main: all four new steps pass in Chromium.
  • 9a9f2d8: in Chromium, all four fail. In Firefox, items 1, 2 and 4 fail.
  • The Firefox exception: Firefox has no 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.
  • Two cases didn't reproduce at first, so I rebuilt them to Sol's setups. A select multiple showed 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.

  • The P2, an inert ancestor outside the modal: a modal dialog escapes its ancestors' inertness. Native Tab from A reaches B in Chromium and Firefox, and both report interactivity: auto inside it. The helper used closest("[inert]"), found no stops, and cancelled the Tab. It now counts inert only from the dialog down to the element (isInertIn), for stops and for the interactivity rule alike.
  • The new step, "in a dialog inside an inert container, whose inertness it escapes":
    • on main: Tab from A reaches B in both browsers, and only the wrap that follows fails, as in every wrap step;
    • at 87129a3: it fails at B in both;
    • at head: it passes, with the wrap.
  • The P3: the skill now says CSS interactivity: inert outside an inert subtree.

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's chromium project after #1302) and Firefox.

Step Main Previous head 90f4f7c Head
both ways round its controls, past the ones Tab skips ✘ ✓ ✓
with rows added while it is open ✘ ✓ ✓
in a dialog opened over it, though that one comes first in the page ✘ ✓ ✓
on the dialog itself while it has no controls ✘ ✓ ✓
after a wrap, a click on Patchy's page keeps focus there ✘ (at the wrap) ✓ ✓
onto a first field that takes a quarter of a second to focus ✘ ✓ ✓
from the dialog on top once the one below is written open ✘ (at the wrap) ✓ ✓
the Preact page's Native <dialog> ✘ ✓ ✓
where a window listener the page added later takes Tab ✓ ✓ ✓
a control that takes Tab, a removed row, a date input, a closed shadow root, a radio group, positive tabindex ✓ ✓ ✓
from the control that opened a popover in the dialog ✓ ✘ ✓
before a shadow host laid out as display: contents ✓ ✘ ✓
before an editable region with a stop inside that shows ✓ ✘ ✓
before an image map's link ✓ ✘ in both Chromiums ✓
in a dialog that scrolls ✓ ✘ in both Chromiums ✓
where reading-flow orders the dialog ✓, ✘ in Firefox ✘ in both Chromiums ✓

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:

  • all of focus.spec.ts with --repeat-each=3 in chromium and firefox: 60 passed;
  • hotkeys.spec.ts and shortcut-setting.spec.ts: 27 passed.

Where it installs.

  • patchy/preact: the issue named preact/runtime.ts, but the repo's lint forbids ../ imports from packages/patchy/src/preact/, so the call sits in src/preact.ts, the patchy/preact entry. Pages may import only SDK entry points, so every Preact page imports it to render.
  • The generated client: it calls keepTabInModals() from patchy/client. Pages reach patchy/client only through the generated client.

How it was verified

  • Browser, tier 1:
    • focus.spec.ts: the three-way comparison above, in the headless shell, desktop Chromium and Firefox (CI's projects, with Fission on).
    • Hotkeys and the shortcut setting: hotkeys.spec.ts and shortcut-setting.spec.ts in the chromium project, now desktop Chromium, 27 passed. That includes the sheet's own Tab round its buttons.
  • Unit: the client.test.ts case per tier checks that the generated client's page bundle carries the helper. With hotkeys, hotkeySheet, hotkeyRules, devLifecycle and pageImports, 75 passed.
  • Checks: pnpm format:check, pnpm lint, pnpm typecheck:tests, and the patchy typecheck and build.
  • Not run:
    • pnpm verify in full, WebKit, and headful browsers.
    • The SDK's install.test.ts, which fails on this machine because its sandboxed PATH finds no npm. It doesn't touch this change.

Hit every surface. These applied:

  • The CLI: patchy/client exports keepTabInModals, and the generated client calls it. packages/patchy/README.md says Tab wraps in plain dialogs and richer ones keep the browser's.
  • Project skills: the patchy-hotkeys project 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:

In pages on patchy/preact or the generated client, Tab now wraps inside a plain modal <dialog> opened with showModal(): from its last control to its first, and Shift+Tab from its first to its last; a plain dialog with no controls keeps focus. A plain dialog holds only ordinary containers and text with buttons, links, selects, checkboxes, summaries, one-line inputs and elements with tabindex="0". A richer dialog, such as one with a textarea, radio, date input, frame, popover, custom element, scrolling region or positive tabindex, keeps the browser's own Tab, and so does every dialog while a popover is open anywhere in the page. There, Tab can still leave for Patchy's page, where Escape stops closing the dialog. A patch's own Tab wrapping for a plain dialog can come out. Versions already published behave as before until they're built and published again.

Release impact

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

SDK page behaviour only, and only in patches rebuilt on this release. Nothing changes on the server or in published versions.

  • What does a revert leave behind? Patches built and published while this was in place keep the helper in their bundles. Nothing else.
  • 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.

@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:l 501-1,000 changed lines labels Nov 12, 2026
@allisonmahmood
allisonmahmood force-pushed the t3/sdk-modal-tab-trap branch 3 times, most recently from 90f4f7c to 9a9f2d8 Compare November 12, 2026 20:07
@allisonmahmood allisonmahmood changed the title fix(sdk): Tab stays inside a patch's open modal dialog fix(sdk): Tab stays inside a patch's open plain modal dialog Nov 12, 2026
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]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol), rounds 1 to 6.

Round, commit Design Findings Outcome
1, 076cf63 Predicts tab order and moves focus itself 3 blocking (date inputs, closed shadow roots, radio groups), 3 should-fix Redesigned
2, 230da14 Catches focus after it leaves, then hands it back A retry window that stole deliberate shell clicks; timing-dependent Redesigned
3, 90f4f7c "Wrap only when sure" 7 cases where "sure" skipped reachable stops Switched to an allowlist
4, 9a9f2d8 Allowlist: plain dialogs only 4 tightenings (details without summary, SVG links, CSS inert, option tabindex) and a doc line Fixed in 87129a3
5, 87129a3 An inert ancestor outside the modal trapped focus Fixed in 9a73b37: inert counts only from the dialog down
6, 9a73b37 Nothing blocking

Round 6 checked:

  • A → B native, then B → A wraps, and Shift+Tab wraps;
  • nested modals with inert wrappers, both between them and around them;
  • CSS interactivity: inert keeping the browser's fallback.

Dismissed, with reasons in the body:

  • A closed shadow root on a standard element. It can't be detected, and it needs page code attaching a closed root to a standard element inside a modal.
  • A canceller registered as a bubble listener from a capture listener for the same event. Nothing added once the key's bubble at window has begun can run after it.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 9a73b37 (base df0f62e) on team, by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

How: I built four real tier 1 repo patches with patchy init, then published them with patchy publish from the environment's CLI, logged in as Ada. Ben opened each at its address in a throwaway Playwright config, never committed, with three projects: the repo's chromium (desktop, channel: "chromium"), Playwright's default headless shell, and firefox with Fission on.

Patch SDK Page
dialogs-plain head framework-free, generated client only (no Preact in the bundle)
dialogs-preact head patchy/preact + patchy/hotkeys; HotkeySheet mounts only on demand, so the first checks see patchy/preact's install alone
dialogs-plain-main, dialogs-preact-main main the same repos with main's pnpm --filter patchy build tarball in node_modules/patchy and main's generateClient() output as the client

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 patchy.download(). Each line below reads key → where focus went: #id in the patch, shell:… on Patchy's page, away once the page itself lost focus. taken is whether anything called preventDefault() on the Tab.

What acceptance asked

  • 1. Plain form dialog: passed in all three browsers.
    • Tab and Shift+Tab wrap and never leave the frame, with and without a download card. Three rounds without the card, then a round with it.
    • Escape closed the dialog every time.
    • Firefox stops on the dialog itself on Shift+Tab, as natively, then wraps.
    • On main, with the card showing, Tab from Save reaches the card's Download in all three browsers, and Escape then leaves the dialog open.
    [chromium] with card, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
    [chromium] with card, back:    Shift+Tab→#save
    [chromium] with card: Escape closed the dialog
    [chromium] main, with card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→shell:button Download
    [chromium] main, with card: after Escape focus=shell:button Download dialog open=true
    [firefox]  with card, back:    Shift+Tab→#form Shift+Tab→#save
    [firefox]  main, no card: Tab→… Tab→#save Tab→patch:body
    
    The Preact page wraps the same way through patchy/preact alone, and on main it leaves: Tab→#save Tab→away in Chromium, Tab→patch:body in Firefox.
  • 2. The same dialog inside an inert container: passed in all three. It wraps both ways and Escape closes it.
    [chromium] sheltered, forward: Tab→#s-kind Tab→#s-urgent Tab→#s-cancel Tab→#s-save Tab→#s-name
    [firefox]  sheltered, back:    Shift+Tab→#sheltered Shift+Tab→#s-save
    
  • 3. Richer dialogs keep the browser's own Tab, as on main: passed in all three. Every case lands in the same place on head and main, with taken=false. The cases: a scrolling dialog (Tab from last, Shift+Tab from first), a textarea, a radio group, a closed popover, an open popover, a custom element, and <details> without a summary.
    [chromium] textarea, Tab from last:      head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
    [chromium] scrolling, Shift+Tab first:   head Shift+Tab→#scroll taken=false | main Shift+Tab→#scroll taken=false
    [chromium] open popover, Tab from invoker: head Tab→#po-tip-button then Tab→shell:button Download | main (same)
    
  • 4. Nested modals and an empty modal: passed in all three.
    • The inner dialog comes before the outer one in the page. Tab wraps in the inner one; after Escape, Tab wraps in the outer one.
    • The empty modal keeps focus on itself.
    [firefox] inner over outer: Tab→#in-no Tab→#in-yes Shift+Tab→#inner Shift+Tab→#in-no
    [firefox] outer after inner closed: Tab→#ou-close Tab→#ou-title
    [firefox] empty: Tab→#empty Shift+Tab→#empty Tab→#empty
    
  • 5. Nothing steals focus after a wrap: passed in all three. After a wrap:
    • a download card appearing leaves focus on #name;
    • a click on the card's text keeps focus on Patchy's page, 400 ms later too;
    • focusing the card's Not now keeps it;
    • ⌘⇧K opens Go to, which still holds focus 400 ms later. Escape closes it, focus goes back to #name, and the next Tab from Save still wraps.
  • 6. A page listener that handles Tab keeps it: passed in all three, on head and main. A listener on the dialog sends Tab from Save to Kind: Tab→#li-kind, taken=true.
  • 7. The shortcuts sheet keeps Tab among its buttons: passed in all three, on head and main. It went forward and back round every button.
    short: 4 buttons, scrolls=false, 10 presses, 0 outside
    tall:  28 buttons, scrolls=true, 58 presses, 0 outside
    
  • 8. A patch built on main's SDK is unchanged: passed.
    • The published HTML's sha256 equals the local Vite build of the main-SDK repo, for both patches.
    • The served frame documents carry the helper only when built with it, so nothing is injected at serve time: dialogs-plain has :popover-open 1, dialogs-plain-main and dialogs-preact-main have 0.
    • Both behave as on main, as in 1, 3 and 7 above.
  • 9. Specs: passed.
    • Locally, focus.spec.ts --repeat-each=3: chromium 30 passed (1.6m), firefox 30 passed (1.7m).
    • CI on 9a73b37: the browser job passed. Its chromium project ran 182 tests, focus.spec.ts:712 and :1020 included, and hotkeys/shortcut-setting with them. Its firefox project passed 10, both new tests included. Every other required check is green.

Golden journeys

  • Publish a page: passed in part. Ada's CLI published four repo patches, and Ben opened each at its address with the patch frame live. Home, retire and restore weren't exercised.
  • The other journeys aren't touched by an SDK page-only change, so I didn't run them.

Rollback answers: they match the diff.

  • No migrations, packages/api, CLI flags or --json, or infra change.
  • A revert leaves the helper in bundles built meanwhile, which is harmless.
  • A repo generated meanwhile has keepTabInModals in its generated client. Its pin no longer matches the instance's tarball after a revert, so publish asks for patchy refresh, which regenerates the client.
  • No one-way label is needed.

Not run

  • WebKit and headed browsers: not asked, and all runs were headless. Keys are Playwright's trusted input, not a person's OS keyboard.
  • pnpm verify: CI's suites on the head cover it.

Notes

  1. Residual leak in Firefox from a click, the same as main. In a plain dialog, a click on the blank area below Save focuses the dialog itself. Firefox's starting point is then past the last control, so Tab leaves the frame, and with a download card showing, Escape then leaves the dialog open:
    [firefox] head, card=true:  click below Save (#form), Tab→shell:button Download, Escape → dialog open=true
    [firefox] head, card=false: click below Save (#form), Tab→patch:body,           Escape → dialog open=false
    
    • Chromium and the headless shell go to #name from there. A click on the heading followed by Shift+Tab wraps to Save in all three, where main leaves.
    • wrapTo leaves a forward Tab from the dialog itself to the browser ("The dialog itself comes before what it holds"). That matches Chromium's order but not Firefox's click starting point.
    • It isn't a regression, and it's outside the PR's claim, which covers Tab from the last stop. It's worth a follow-up, or a word in the skill.
  2. pnpm dev up fails installing the environment's CLI: pinned npm 12 refuses the local tarball (EALLOWREMOTE) #1240. pnpm dev up team failed with npm 12.2.1 (EALLOWREMOTE) on the CLI tarball. I ran the dev runner with Bun and npm 11.19 first on PATH: bun --conditions=development scripts/dev/src/main.ts up team.
  3. The Firefox focus.spec run reused the build. It ran with PATCHY_TIER1_SKIP_BUILD=1, right after the Chromium run had built the same commit.
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
[chromium] no card, round 1, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name Tab→#kind
[chromium] no card, round 1, back: Shift+Tab→#name Shift+Tab→#save Shift+Tab→#cancel
[chromium] with card, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
[chromium] with card, back: Shift+Tab→#save
[chromium] with card: Escape closed the dialog
[chromium] main, no card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→away
[chromium] main, no card: after Escape, dialog open=false
[chromium] main, with card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→shell:button Download
[chromium] main, with card: after Escape focus=shell:button Download dialog open=true
[chromium] sheltered, forward: Tab→#s-kind Tab→#s-urgent Tab→#s-cancel Tab→#s-save Tab→#s-name
[chromium] sheltered, back: Shift+Tab→#s-save
[chromium] scrolling, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[chromium] scrolling, Shift+Tab from first: head Shift+Tab→#scroll taken=false | main Shift+Tab→#scroll taken=false
[chromium] textarea, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[chromium] radio group, Tab from checked radio: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[chromium] closed popover, Tab from its invoker: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[chromium] open popover, Tab from its invoker: head Tab→#po-tip-button taken=false then Tab→shell:button Download taken=false | main Tab→#po-tip-button taken=false then Tab→shell:button Download taken=false
[chromium] custom element, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[chromium] details without summary, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[chromium] inner over outer: Tab→#in-no Tab→#in-yes Shift+Tab→#in-no
[chromium] outer after inner closed: Tab→#ou-close Tab→#ou-title
[chromium] empty: Tab→#empty Shift+Tab→#empty Tab→#empty
[chromium] a card appearing after a wrap leaves focus on #name
[chromium] after the click: shell:body; 400 ms later: shell:body
[chromium] switcher: shell:input Go to after 400 ms
[chromium] switcher closed, focus: #name
[chromium] /acme/dialogs-plain listener: Tab→#li-kind
[chromium] /acme/dialogs-plain-main listener: Tab→#li-kind
[chromium] preact head, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
[chromium] preact head, back: Shift+Tab→#save Shift+Tab→#cancel
[chromium] preact main, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→away
[chromium] /acme/dialogs-preact short: 4 buttons, scrolls=false, 10 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[chromium] /acme/dialogs-preact tall: 28 buttons, scrolls=true, 58 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[chromium] /acme/dialogs-preact-main short: 4 buttons, scrolls=false, 10 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[chromium] /acme/dialogs-preact-main tall: 28 buttons, scrolls=true, 58 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[headless-shell] no card, round 1, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name Tab→#kind
[headless-shell] no card, round 1, back: Shift+Tab→#name Shift+Tab→#save Shift+Tab→#cancel
[headless-shell] with card, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
[headless-shell] with card, back: Shift+Tab→#save
[headless-shell] with card: Escape closed the dialog
[headless-shell] main, no card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→away
[headless-shell] main, no card: after Escape, dialog open=true
[headless-shell] main, with card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→shell:button Download
[headless-shell] main, with card: after Escape focus=shell:button Download dialog open=true
[headless-shell] sheltered, forward: Tab→#s-kind Tab→#s-urgent Tab→#s-cancel Tab→#s-save Tab→#s-name
[headless-shell] sheltered, back: Shift+Tab→#s-save
[headless-shell] scrolling, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[headless-shell] scrolling, Shift+Tab from first: head Shift+Tab→#scroll taken=false | main Shift+Tab→#scroll taken=false
[headless-shell] textarea, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[headless-shell] radio group, Tab from checked radio: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[headless-shell] closed popover, Tab from its invoker: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[headless-shell] open popover, Tab from its invoker: head Tab→#po-tip-button taken=false then Tab→shell:button Download taken=false | main Tab→#po-tip-button taken=false then Tab→shell:button Download taken=false
[headless-shell] custom element, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[headless-shell] details without summary, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[headless-shell] inner over outer: Tab→#in-no Tab→#in-yes Shift+Tab→#in-no
[headless-shell] outer after inner closed: Tab→#ou-close Tab→#ou-title
[headless-shell] empty: Tab→#empty Shift+Tab→#empty Tab→#empty
[headless-shell] a card appearing after a wrap leaves focus on #name
[headless-shell] after the click: shell:body; 400 ms later: shell:body
[headless-shell] switcher: shell:input Go to after 400 ms
[headless-shell] switcher closed, focus: #name
[headless-shell] /acme/dialogs-plain listener: Tab→#li-kind
[headless-shell] /acme/dialogs-plain-main listener: Tab→#li-kind
[headless-shell] preact head, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
[headless-shell] preact head, back: Shift+Tab→#save Shift+Tab→#cancel
[headless-shell] preact main, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→away
[headless-shell] /acme/dialogs-preact short: 4 buttons, scrolls=false, 10 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[headless-shell] /acme/dialogs-preact tall: 28 buttons, scrolls=true, 58 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[headless-shell] /acme/dialogs-preact-main short: 4 buttons, scrolls=false, 10 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[headless-shell] /acme/dialogs-preact-main tall: 28 buttons, scrolls=true, 58 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[firefox] no card, round 1, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name Tab→#kind
[firefox] no card, round 1, back: Shift+Tab→#name Shift+Tab→#form Shift+Tab→#save Shift+Tab→#cancel
[firefox] with card, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
[firefox] with card, back: Shift+Tab→#form Shift+Tab→#save
[firefox] with card: Escape closed the dialog
[firefox] main, no card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→patch:body
[firefox] main, no card: after Escape, dialog open=false
[firefox] main, with card: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→shell:button Download
[firefox] main, with card: after Escape focus=shell:button Download dialog open=true
[firefox] sheltered, forward: Tab→#s-kind Tab→#s-urgent Tab→#s-cancel Tab→#s-save Tab→#s-name
[firefox] sheltered, back: Shift+Tab→#sheltered Shift+Tab→#s-save
[firefox] scrolling, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[firefox] scrolling, Shift+Tab from first: head Shift+Tab→#scroll taken=false | main Shift+Tab→#scroll taken=false
[firefox] textarea, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[firefox] radio group, Tab from checked radio: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[firefox] closed popover, Tab from its invoker: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[firefox] open popover, Tab from its invoker: head Tab→#po-tip-button taken=false then Tab→shell:button Download taken=false | main Tab→#po-tip-button taken=false then Tab→shell:button Download taken=false
[firefox] custom element, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[firefox] details without summary, Tab from last: head Tab→shell:button Download taken=false | main Tab→shell:button Download taken=false
[firefox] inner over outer: Tab→#in-no Tab→#in-yes Shift+Tab→#inner Shift+Tab→#in-no
[firefox] outer after inner closed: Tab→#ou-close Tab→#ou-title
[firefox] empty: Tab→#empty Shift+Tab→#empty Tab→#empty
[firefox] a card appearing after a wrap leaves focus on #name
[firefox] after the click: shell:body; 400 ms later: shell:body
[firefox] switcher: shell:input Go to after 400 ms
[firefox] switcher closed, focus: #name
[firefox] /acme/dialogs-plain listener: Tab→#li-kind
[firefox] /acme/dialogs-plain-main listener: Tab→#li-kind
[firefox] preact head, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→#name
[firefox] preact head, back: Shift+Tab→#form Shift+Tab→#save Shift+Tab→#cancel
[firefox] preact main, forward: Tab→#kind Tab→#urgent Tab→#cancel Tab→#save Tab→patch:body
[firefox] /acme/dialogs-preact short: 4 buttons, scrolls=false, 10 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[firefox] /acme/dialogs-preact tall: 28 buttons, scrolls=true, 58 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[firefox] /acme/dialogs-preact-main short: 4 buttons, scrolls=false, 10 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts
[firefox] /acme/dialogs-preact-main tall: 28 buttons, scrolls=true, 58 presses, outside=0, first=Single-key shortcuts wrapTo=Single-key shortcuts

@allisonmahmood
allisonmahmood merged commit 8ed4d79 into main Nov 12, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the t3/sdk-modal-tab-trap branch November 12, 2026 21:44
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
…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]>
allisonmahmood added a commit that referenced this pull request Nov 22, 2026
…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]>
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:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Patches' modal dialogs keep Tab inside the patch frame

1 participant