The best way to control Claude Code, Codex and more from any computer or phone
fix(web): choosing a provider in the model picker no longer raises the phone keyboard (#36999)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Vytor Rennan committed
Nov 14, 2026 at 22:51 UTC
0983ab3e73206f9a79873fb19fbe2a8a8bc3de48
3 files changed
+63
-1
apps/web/src/components/chat/ModelPickerContent.tsx
+2
@@ -466,6 +466,8 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
466
467
const handleSelectInstance = (instanceId: ProviderInstanceId | "favorites") => {
468
setSelectedInstanceId(instanceId);
469
+ // Focusing the search on touch raises the on-screen keyboard on every provider tap.
470
+ if (window.matchMedia("(pointer: coarse)").matches) return;
471
window.requestAnimationFrame(() => {
472
focusSearchInput();
473
});
apps/web/src/components/chat/ProviderModelPicker.browser.test.tsx
+57
@@ -218,3 +218,60 @@ it("opens on the active provider when every favorite belongs to a disabled provi
218
await screen.getByRole("button", { name: "Choose model" }).click();
219
await expect.element(page.getByRole("option", { name: /Codex model/ })).toBeVisible();
220
});
221
+
222
+it("keeps the touch keyboard down while choosing a provider", async () => {
223
+ const entries = deriveProviderInstanceEntries(
224
+ ["Codex", "Claude"].map((name) => ({
225
+ instanceId: ProviderInstanceId.make(name.toLowerCase()),
226
+ driver: ProviderDriverKind.make(name.toLowerCase()),
227
+ enabled: true,
228
+ installed: true,
229
+ version: null,
230
+ status: "ready" as const,
231
+ auth: { status: "authenticated" as const },
232
+ checkedAt: "2026-01-01T00:00:00.000Z",
233
+ models: [
234
+ { slug: name.toLowerCase(), name: `${name} model`, isCustom: false, capabilities: {} },
235
+ ],
236
+ slashCommands: [],
237
+ skills: [],
238
+ })),
239
+ );
240
+ const [codex] = entries;
241
+ const matchMedia = window.matchMedia.bind(window);
242
+ using _touch = vi.spyOn(window, "matchMedia").mockImplementation((query) =>
243
+ query === "(pointer: coarse)"
244
+ ? ({
245
+ matches: true,
246
+ media: query,
247
+ onchange: null,
248
+ addEventListener: () => {},
249
+ removeEventListener: () => {},
250
+ addListener: () => {},
251
+ removeListener: () => {},
252
+ dispatchEvent: () => false,
253
+ } as MediaQueryList)
254
+ : matchMedia(query),
255
+ );
256
+
257
+ await using screen = await render(
258
+ <ProviderModelPicker
259
+ environmentId={null}
260
+ activeInstanceId={codex!.instanceId}
261
+ model="codex"
262
+ lockedProvider={null}
263
+ instanceEntries={entries}
264
+ modelOptionsByInstance={new Map(entries.map((entry) => [entry.instanceId, entry.models]))}
265
+ triggerAriaLabel="Choose model"
266
+ onInstanceModelChange={() => {}}
267
+ />,
268
+ );
269
+ await screen.getByRole("button", { name: "Choose model" }).click();
270
+ const search = page.getByPlaceholder("Search models...");
271
+ const popup = search.element().closest('[data-slot="popover-popup"]');
272
+ await vi.waitFor(() => expect(document.activeElement).toBe(popup));
273
+
274
+ await page.getByRole("button", { name: /^Claude/ }).click();
275
+ await expect.element(page.getByRole("option", { name: /Claude model/ })).toBeVisible();
276
+ await expect.element(search).not.toHaveFocus();
277
+});
apps/web/src/components/chat/ProviderModelPicker.tsx
+4
-1
@@ -20,6 +20,7 @@ import { Badge } from "../ui/badge";
20
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
21
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
22
import { cn } from "~/lib/utils";
23
+import { useMediaQuery } from "../../hooks/useMediaQuery";
24
import { ModelPickerContent, resolveModelPickerSelectedModel } from "./ModelPickerContent";
25
import { retainedModelWhileProviderLocked } from "./ProviderModelPicker.logic";
26
import { ChatGptSharingControl } from "./ChatGptSharingControl";
@@ -149,6 +150,8 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
150
const searchInputRef = useRef<HTMLInputElement>(null);
151
const triggerRef = useRef<HTMLButtonElement>(null);
152
const popupRef = useRef<HTMLDivElement | null>(null);
153
+ // Touch opens on the popup itself so the on-screen keyboard stays down until the search is tapped.
154
+ const isCoarsePointer = useMediaQuery({ pointer: "coarse" });
155
const size = props.size ?? "sm";
156
const docked = props.effortColumn !== undefined;
157
@@ -445,7 +448,7 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
448
unlock?.();
449
};
450
}}
448
- initialFocus={searchInputRef}
451
+ initialFocus={isCoarsePointer ? popupRef : searchInputRef}
452
align={props.popupAlign ?? "start"}
453
// Docked, the popup opens above the composer and slides over it when that space is short,
454
// so a short window gets its full height (Floating UI sizes to the viewport) instead of a sliver.