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 22, 00:45 UTC
fix(web): settings search shortcuts follow the physical key on non-US layouts (#33395)
Julius Marminge committed
Nov 10, 2026 at 19:04 UTC
f7b81e1d1115bc7284b39161d3cd6c7f3184eb1c
2 files changed
+33
-5
apps/web/src/components/settings/SettingsSidebarNav.composition.browser.test.tsx
+23
@@ -42,3 +42,26 @@ it("ignores composing keys in the search", async () => {
42
expect(screen.router?.state.location.pathname).toBe("/settings/appearance"),
43
);
44
});
45
+
46
+it("opens search from the physical Slash and F keys on non-US layouts", async () => {
47
+ await using _screen = await render(
48
+ <SidebarProvider defaultOpen>
49
+ <SettingsSidebarNav pathname="/settings/general" />
50
+ </SidebarProvider>,
51
+ { router: "/settings/general" },
52
+ );
53
+ const search = page.getByRole("combobox", { name: "Search settings" });
54
+
55
+ for (const { init, opens } of [
56
+ { init: { key: "/", code: "Digit7", shiftKey: true }, opens: true }, // German Shift+7
57
+ { init: { key: ".", code: "Slash" }, opens: true }, // Russian Slash key
58
+ { init: { key: "а", code: "KeyF", ctrlKey: true }, opens: true }, // Russian Ctrl+F
59
+ { init: { key: "?", code: "Slash", shiftKey: true }, opens: false },
60
+ ]) {
61
+ if (document.activeElement instanceof HTMLElement) document.activeElement.blur();
62
+ const event = new KeyboardEvent("keydown", { ...init, bubbles: true, cancelable: true });
63
+ await act(() => document.body.dispatchEvent(event));
64
+ expect(event.defaultPrevented, JSON.stringify(init)).toBe(opens);
65
+ if (opens) await expect.element(search).toHaveFocus();
66
+ }
67
+});
apps/web/src/components/settings/SettingsSidebarNav.tsx
+10
-5
@@ -33,6 +33,7 @@ import {
33
WrenchIcon,
34
XIcon,
35
} from "lucide-react";
36
+import { resolveEventKeys } from "@t3tools/shared/keybindings";
37
import { useLocation, useNavigate } from "@tanstack/react-router";
38
39
import { cn } from "../../lib/utils";
@@ -157,13 +158,17 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
158
useEffect(() => {
159
const handleKeyDown = (event: globalThis.KeyboardEvent) => {
160
if (event.defaultPrevented || event.isComposing) return;
161
+ const eventKeys = resolveEventKeys(event);
162
const isFindShortcut =
161
- event.key.toLowerCase() === "f" &&
162
- (event.metaKey || event.ctrlKey) &&
163
- !event.altKey &&
164
- !event.shiftKey;
163
+ eventKeys.has("f") && (event.metaKey || event.ctrlKey) && !event.altKey && !event.shiftKey;
164
+ // Shift is allowed only when the layout types "/" with it (German Shift+7); Shift on
165
+ // the physical Slash key types "?" or "," instead.
166
const isSlashShortcut =
166
- event.key === "/" && !event.metaKey && !event.ctrlKey && !event.altKey;
167
+ eventKeys.has("/") &&
168
+ (event.key === "/" || !event.shiftKey) &&
169
+ !event.metaKey &&
170
+ !event.ctrlKey &&
171
+ !event.altKey;
172
if (!isFindShortcut && !isSlashShortcut) return;
173
174
const target = event.target;