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, 03:37 UTC
fix(web): focus popup search from anywhere in its row (#33110)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Tenyoru committed
Nov 21, 2026 at 01:20 UTC
3d54dc96f9684f4bc34a9c7f69599f2fd202a095
3 files changed
+41
-4
apps/web/src/components/ui/combobox.tsx
+2
-2
@@ -106,7 +106,7 @@ function ComboboxInput({
106
107
function ComboboxSearchInput(props: React.ComponentProps<typeof ComboboxInput>) {
108
return (
109
- <div className="min-w-0 shrink-0 px-3 pt-2.5">
109
+ <label className="block min-w-0 shrink-0 cursor-text px-3 pt-2.5">
110
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
111
<SearchIcon
112
aria-hidden="true"
@@ -120,7 +120,7 @@ function ComboboxSearchInput(props: React.ComponentProps<typeof ComboboxInput>)
120
unstyled
121
/>
122
</div>
123
- </div>
123
+ </label>
124
);
125
}
126
apps/web/src/components/ui/menu.tsx
+2
-2
@@ -80,7 +80,7 @@ function MenuSearchInput({
80
...props
81
}: Omit<InputProps, "className" | "size" | "unstyled" | "nativeInput"> & { busy?: boolean }) {
82
return (
83
- <div className="min-w-0 shrink-0 px-2 pt-1.5 pb-1">
83
+ <label className="block min-w-0 shrink-0 cursor-text px-2 pt-1.5 pb-1">
84
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
85
{busy ? (
86
<Spinner
@@ -107,7 +107,7 @@ function MenuSearchInput({
107
}}
108
/>
109
</div>
110
- </div>
110
+ </label>
111
);
112
}
113
apps/web/src/components/ui/search-input.browser.test.tsx
new
+37
@@ -0,0 +1,37 @@
1
+import { expect, it } from "vite-plus/test";
2
+import { userEvent } from "vite-plus/test/browser";
3
+
4
+import { render } from "../../../test/render";
5
+import { Combobox, ComboboxSearchInput } from "./combobox";
6
+import { MenuSearchInput } from "./menu";
7
+
8
+it.each(["combobox", "menu"] as const)(
9
+ "focuses the %s search when clicking anywhere in its row",
10
+ async (kind) => {
11
+ await using screen = await render(
12
+ <div className="w-96" data-testid="search-row">
13
+ {kind === "combobox" ? (
14
+ <Combobox>
15
+ <ComboboxSearchInput aria-label="Search options" />
16
+ </Combobox>
17
+ ) : (
18
+ <MenuSearchInput aria-label="Search options" />
19
+ )}
20
+ </div>,
21
+ { router: false /* input focus does not involve navigation */ },
22
+ );
23
+ const row = screen.getByTestId("search-row");
24
+ const field = screen.getByRole(kind === "combobox" ? "combobox" : "textbox", {
25
+ name: "Search options",
26
+ });
27
+ const { width, height } = row.element().getBoundingClientRect();
28
+
29
+ for (const x of [4, width / 2, width - 20, width - 4]) {
30
+ field.element().blur();
31
+ await userEvent.click(row, { position: { x, y: height / 2 } });
32
+ await expect.element(field).toHaveFocus();
33
+ }
34
+ await userEvent.keyboard("project");
35
+ await expect.element(field).toHaveValue("project");
36
+ },
37
+);