The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 21:00 UTC
fix(web): don't offer VS Code on iPad, iPhone and Android browsers (#27557)
Julius Marminge committed
Nov 11, 2026 at 16:32 UTC
cd8fc91a579e5ec232be88830cfafeb593b8cea0
5 files changed
+79
-6
apps/web/src/components/chat/OpenInPicker.browser.test.tsx
+19
@@ -202,6 +202,25 @@ describe("remote editor links", () => {
202
expect(state.openUrl).toHaveBeenCalledWith(expect.stringContaining("ssh-remote+sol"));
203
expect(state.run).not.toHaveBeenCalled();
204
});
205
+
206
+ it("explains why a phone or tablet browser has no editor to open", async () => {
207
+ await using fixture = await setup();
208
+ const { renderPicker, byLabel, primaryButton, menuItems, click, pressOpenFavorite } = fixture;
209
+ state.remote = { mode: "remote-links", host: { kind: "ssh-alias", host: "sol" } };
210
+ state.clientEditors = [];
211
+ await renderPicker();
212
+
213
+ expect(primaryButton().disabled).toBe(true);
214
+ expect((await pressOpenFavorite()).defaultPrevented).toBe(false);
215
+ await click(byLabel("Choose editor"));
216
+ await vi.waitFor(() =>
217
+ expect(menuItems().map((item) => item.textContent)).toEqual([
218
+ "Open from a computer to edit on Test host",
219
+ ]),
220
+ );
221
+ expect(menuItems()[0]!.getAttribute("aria-disabled")).toBe("true");
222
+ expect(state.openUrl).not.toHaveBeenCalled();
223
+ });
224
});
225
226
describe("open in editor announcement", () => {
apps/web/src/components/chat/OpenInPicker.tsx
+9
-2
@@ -286,11 +286,18 @@ export const OpenInPicker = memo(function OpenInPicker({
286
const primaryOption = options.find(({ value }) => value === preferredEditor) ?? null;
287
const primaryLabel = isPanel ? `Open in ${primaryOption?.label ?? "editor"}` : "Open";
288
289
+ const unavailableReason =
290
+ remote.mode === "remote-unavailable"
291
+ ? `No SSH route to ${environmentLabel}`
292
+ : remote.mode === "remote-links" && options.length === 0
293
+ ? `Open from a computer to edit on ${environmentLabel}`
294
+ : null;
295
+
296
const editorItems = (
297
<>
291
- {remote.mode === "remote-unavailable" ? (
298
+ {unavailableReason !== null ? (
299
<MenuItem density={presentation === "menu" ? "touch" : "default"} disabled>
293
- No SSH route to {environmentLabel}
300
+ {unavailableReason}
301
</MenuItem>
302
) : (
303
<>
apps/web/src/connection/clientMetadata.ts
+2
-2
@@ -5,7 +5,7 @@ import type {
5
DesktopBridge,
6
} from "@t3tools/contracts";
7
8
-interface BrowserIdentity {
8
+export interface BrowserIdentity {
9
readonly userAgent: string;
10
readonly platform: string;
11
readonly maxTouchPoints: number;
@@ -32,7 +32,7 @@ function isIpadosDesktopUserAgent(identity: BrowserIdentity): boolean {
32
);
33
}
34
35
-function browserClientOs(identity: BrowserIdentity): ClientOs {
35
+export function browserClientOs(identity: BrowserIdentity): ClientOs {
36
const userAgent = identity.userAgent;
37
if (userAgent.trim() === "") return "unknown";
38
if (/iphone|ipad|ipod/i.test(userAgent) || isIpadosDesktopUserAgent(identity)) return "iOS";
apps/web/src/remoteOpen.test.ts
+41
-1
@@ -6,7 +6,7 @@ import {
6
import { buildRemoteOpenUrl, EnvironmentId } from "@t3tools/contracts";
7
import { describe, expect, it } from "vite-plus/test";
8
9
-import { resolveRemoteOpenState } from "./remoteOpen";
9
+import { remoteFallbackEditors, resolveRemoteOpenState } from "./remoteOpen";
10
11
const environmentId = EnvironmentId.make("environment-1");
12
@@ -179,6 +179,46 @@ describe("resolveRemoteOpenState", () => {
179
});
180
});
181
182
+describe("remoteFallbackEditors", () => {
183
+ it.each([
184
+ {
185
+ // iPadOS Safari requests the desktop site with a Macintosh user agent by default.
186
+ device: "iPad with a desktop user agent",
187
+ userAgent:
188
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15",
189
+ platform: "MacIntel",
190
+ maxTouchPoints: 5,
191
+ },
192
+ {
193
+ device: "iPhone",
194
+ userAgent:
195
+ "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1",
196
+ platform: "iPhone",
197
+ maxTouchPoints: 5,
198
+ },
199
+ {
200
+ device: "Android phone",
201
+ userAgent:
202
+ "Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36",
203
+ platform: "Linux armv81",
204
+ maxTouchPoints: 5,
205
+ },
206
+ ])("offers no desktop editor for remote links on an $device", ({ device: _, ...identity }) => {
207
+ expect(remoteFallbackEditors(identity)).toEqual([]);
208
+ });
209
+
210
+ it("keeps the VS Code fallback for remote links on a Mac", () => {
211
+ expect(
212
+ remoteFallbackEditors({
213
+ userAgent:
214
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15",
215
+ platform: "MacIntel",
216
+ maxTouchPoints: 0,
217
+ }),
218
+ ).toEqual(["vscode"]);
219
+ });
220
+});
221
+
222
describe("buildRemoteOpenUrl", () => {
223
it("roots Windows paths", () => {
224
expect(
apps/web/src/remoteOpen.ts
+8
-1
@@ -10,6 +10,7 @@ import * as Schema from "effect/Schema";
10
import { Atom } from "effect/reactivity";
11
import { useAtomValue } from "@effect/atom-react";
12
13
+import { browserClientOs, type BrowserIdentity } from "~/connection/clientMetadata";
14
import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal";
15
import { isLoopbackHostname } from "~/environments/primary/target";
16
import { useLocalStorage } from "~/hooks/useLocalStorage";
@@ -149,6 +150,12 @@ export function useRemoteOpenState(environmentId: EnvironmentId | null): RemoteO
150
151
const REMOTE_FALLBACK_EDITORS: ReadonlyArray<EditorId> = ["vscode"];
152
153
+// Phone and tablet browsers have no desktop editor to receive a vscode:// remote link.
154
+export function remoteFallbackEditors(identity: BrowserIdentity): ReadonlyArray<EditorId> {
155
+ const os = browserClientOs(identity);
156
+ return os === "iOS" || os === "Android" ? [] : REMOTE_FALLBACK_EDITORS;
157
+}
158
+
159
// Probed once per page: installed editors rarely change, and the probe spawns processes.
160
const remoteCapableEditorsAtom = Atom.make((get): ReadonlyArray<EditorId> => {
161
const probe = window.desktopBridge?.probeRemoteEditors;
@@ -159,7 +166,7 @@ const remoteCapableEditorsAtom = Atom.make((get): ReadonlyArray<EditorId> => {
166
},
167
() => undefined,
168
);
162
- return REMOTE_FALLBACK_EDITORS;
169
+ return remoteFallbackEditors(navigator);
170
}).pipe(Atom.keepAlive, Atom.withLabel("remote-capable-editors"));
171
172
export function useRemoteCapableEditors(): ReadonlyArray<EditorId> {