Skip to content

feat(serving): desktop Safari is supported, proven by its own CI job - #1505

Merged
allisonmahmood merged 6 commits into
mainfrom
t3/support-safari-webkit
Nov 22, 2026
Merged

allisonmahmood merged 6 commits into
mainfrom
t3/support-safari-webkit

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

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 fix(sdk): Tab stays inside a patch's open plain modal dialog #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 fix(sdk): Tab stays inside a patch's open plain modal dialog #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

  • 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

Option+Tab, Safari's Tab to every control on a Mac, left a patch's open
plain modal dialog for Patchy's page, where Escape no longer closed it.
The SDK's Tab helper now takes Option+Tab on a Mac, where Safari and
Chromium move focus by it; plain Tab and every other platform are as
before. Tell Patchy's panel gives focus back to its button after the
switcher closes over it in WebKit too, which hides the panel without a
toggle event.

Every tier 1 browser spec now runs in WebKit on macOS as its own CI job,
browser-webkit, which isn't a required check. Tests that assumed Chromium
or Linux say how WebKit differs, and the docs now claim Safari.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 area:ui Portal and first-party browser pages, shared rendering and styles size:m 100-500 changed lines labels Nov 22, 2026
Option+Tab is taken only on a desktop Mac outside Firefox. Tell Patchy
settles a WebKit switcher close without arming the tap check or waiting,
and an answer landing under the switcher waits for that close. The
forced-download, embed-refusal, field-key and history tests keep their
Chromium and Firefox strength, the WebKit goto waits on iframe#patch and
lets a stalled frame fail, the broker is built for Safari 16 too, and
the docs say what verify and Option+Tab cover.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size:l 501-1,000 changed lines and removed size:m 100-500 changed lines labels Nov 22, 2026
allisonmahmood and others added 4 commits November 22, 2026 07:48
- The Option+Tab promise holds under Safari's default keyboard settings;
  with "Press Tab to highlight each item" on, Safari swaps the two keys.
  Said in the SDK README, the hotkeys skill and modalTab's comment.
- The shell broker and core scripts target Safari 16.4, the oldest that
  runs the shared schemas' lookbehind, instead of 16, which only moved the
  failure from parsing to running.
- WebKit's frame wait follows a shell that loads afresh to its next frame,
  and a closed or crashed page fails it.
- `pnpm verify` is said to leave out server-image and rollback-rehearsal
  too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The build targets are syntax targets: Safari 16.4 parses the shared
  schemas' lookbehind, while what the shell and the SDK call, such as
  Promise.withResolvers, already asks for Safari 17.4 and later.
- The keyboard caveat separates the helper's ends from the browser's own
  moves, and covers macOS's Keyboard navigation as well as Safari's
  "Press Tab to highlight each item".
- WebKit's frame wait waits for the shell goto loaded and no further, as
  its comment says; a test needing a later shell's patch waits for it.
- verify.ts's header matches the docs: server-image and
  rollback-rehearsal stay CI's, and GitHub's own checks stay GitHub's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in WebKit

WebKit's browser-webkit job failed once on the share dialog's Back and
Forward, and the test failed 3 times in 120 runs under load on a Mac. Two
races, both the test's:

- Back before the redrawn dialog's deferred script ran stayed on the
  dialog's first entry. The test now waits for the page's
  DOMContentLoaded first.
- Forward before the list's pageshow had given focus back to the menu's
  button found that hand-back pending and closed the dialog again. Where
  Back passes through the dialog's first entry, the test now waits for
  that focus, which it checked only after Close before.

120 of 120 runs pass under load in WebKit; Chromium and Firefox pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Opening Share and submitting the invite now wait for the dialog page's
deferred script, as `loadDialog` does for the dialog's other loads, so
neither entry can miss its place in the chain under load (Neon's nit on
the previous commit). 120 of 120 runs pass under load in WebKit;
Chromium and Firefox pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked a32187beed3034d87b0e51a29bab0a9bc87f151e (base 76e94bf4324b0bd3865e563b329607e61ee8407a) on disposable tier 1 browser fixtures, by GPT-6.2 Sol in Codex through T3 Code.

Done means

  • Option+Tab — passed. Both SDK dialog cases lost focus at the wrap on the base in macOS WebKit. On the head, Option+Tab and Option+Shift+Tab stayed in the dialog and Escape closed it, for both the generated client and Preact. All nine platform checks passed. Plain Tab dialog coverage passed in Chromium and Firefox on Linux.
  • Tell Patchy — passed. WebKit reproduced both failures on the base. On the head, closing the switcher restored focus to Tell Patchy, and a response received while the panel was hidden preserved the draft and the "couldn't confirm" note. All six Tell Patchy cases passed in all three engines.
  • Browser CI — passed. Chromium passed 192 tests, Firefox passed 189 with 3 skips, and WebKit passed 186 with 6 skips. The job runs the full tier 1 browser suite on macos-15, has no continue-on-error or downstream dependency, and is outside the required ruleset. Existing job definitions match the base. Chromium · Firefox · WebKit
  • Tests and support claim — passed. The docs and SDK capability now name desktop Safari. The Share Back/Forward case passed in all three engines and in five additional consecutive WebKit runs. The rebuilt shell broker, switcher, and relay scripts were byte-for-byte identical to the base.

Golden journeys

  • Sign in, machine login, and publish — passed with fixtures. Browser and packed CLI checks covered the sign-in door and return, device confirmation and revocation, and publish, retire, and restore.
  • Share and find a tool — passed with fixtures. Browser checks covered public/company access, opening a shared patch from Home, and finding and opening a patch through the switcher.
  • Live and tier 2 tools — passed with fixtures. Two open WebKit viewers stayed in sync through tier 2 mutations. tier2-smoke also passed.
  • Invite and join — passed with fixtures. Offline route and browser checks covered invitation, joining the chosen company, revocation, and member deactivation and reactivation.

Rollback answers: Match the diff. Patches built and published during the release retain the new helper in their bundles, which the prior release can still serve. No migration or persistent server contract changed.

Not run

  • Named brightline and team walkthroughs. npm refused the disposable CLI tarball from its loopback URL with EALLOWREMOTE. The Brightline processes were stopped by recorded PID. The journey results above use fixtures and CI.
  • Independent Safari.app and Chromium-on-Mac checks. The Mac run used Playwright WebKit. Mobile Safari and nondefault keyboard settings were outside the claim.
  • Raw Actions log export. GitHub CLI withheld terminal escape sequences. Formatted job logs supplied the counts above.

Notes

  • The base comparison used the head's test harness and rebuilt the base application and SDK. The new platform unit test also failed on the base because the helper did not exist there.

@allisonmahmood
allisonmahmood merged commit 3338bb9 into main Nov 22, 2026
30 checks passed
@allisonmahmood
allisonmahmood deleted the t3/support-safari-webkit branch November 22, 2026 13:07
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 area:ui Portal and first-party browser pages, shared rendering and styles size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant