@devries-cameron20 / t3code-1 / commits / 1c7d945439
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): typing in a file after a find match stays in the file (#37674)

Julius Marminge committed Nov 16, 2026 at 07:48 UTC 1c7d9454393316cd81dc4296b5a25eb66b72bfbf
4 files changed +30 -11
apps/web/src/components/files/FilePreviewPanel.browser.test.tsx
+11
@@ -223,6 +223,17 @@ describe("source file focus", () => {
223 isMacPlatform(navigator.platform) ? "{Meta>}f{/Meta}" : "{Control>}f{/Control}",
224 );
225 await vi.waitFor(() => expect(deepActiveElement()).toBeInstanceOf(HTMLInputElement));
226 +
227 + const findField = deepActiveElement() as HTMLInputElement;
228 + await userEvent.keyboard("server");
229 + findField.blur();
230 + expect(focus.focus("panel", false)).toBe(true);
231 + await vi.waitFor(editorHasFocus);
232 + const editor = deepActiveElement() as HTMLElement;
233 + await userEvent.keyboard("ab");
234 + await vi.waitFor(() => expect(editor.textContent).toContain("xabconst server"));
235 + expect(findField.value).toBe("server");
236 + editorHasFocus();
237 });
238
239 it("focuses the editor when a file row is clicked or activated with Enter", async () => {
patches/@pierre__diffs@1.7.0-beta.4.patch
+12 -4
@@ -1,5 +1,5 @@
1 diff --git a/dist/editor/editor.js b/dist/editor/editor.js
2 -index b4c280390b52434f63fbe7916d81b150d9006fb4..8564980bdfe2ef8e17e8ab0a87627709091101ee 100644
2 +index b4c280390b52434f63fbe7916d81b150d9006fb4..cb7fb89a22c8adac9ea951b8767b5fd446347746 100644
3 --- a/dist/editor/editor.js
4 +++ b/dist/editor/editor.js
5 @@ -95,6 +95,7 @@ var Editor = class {
@@ -38,7 +38,15 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8564980bdfe2ef8e17e8ab0a87627709
38 const replacementFocusTargetIsContent = (event) => {
39 const target = event.composedPath()[0];
40 return target instanceof Node && this.#contentElement?.contains(target) === true;
41 -@@ -1397,6 +1412,7 @@ var Editor = class {
41 +@@ -1130,6 +1145,7 @@ var Editor = class {
42 + this.#editorEventDisposes = [
43 + addEventListener(contentEl, "focus", () => {
44 + this.#contentHasFocus = true;
45 ++ this.#retainSearchPanelFocus = false;
46 + onFocus?.();
47 + if (!this.#isContentMouseDown && !this.#isComposing && this.#focusRequest == null && this.#selections !== void 0 && this.#selections.length > 0) this.#setWindowSelection(this.#selections.at(-1));
48 + }, { passive: true }),
49 +@@ -1397,6 +1413,7 @@ var Editor = class {
50 this.#resizeObserver = new ResizeObserver(this.#handleLayoutResize);
51 this.#resizeObserver.observe(contentEl);
52 this.#resizeObserver.observe(contentEl.parentElement);
@@ -46,7 +54,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8564980bdfe2ef8e17e8ab0a87627709
54 this.#computeContentOffset(contentEl);
55 }
56 #handleCustomPasteEvent = async () => {
49 -@@ -1852,7 +1868,9 @@ var Editor = class {
57 +@@ -1852,7 +1869,9 @@ var Editor = class {
58 const change = textDocument.applyEdits(edits, true, selections, nextSelections, true);
59 if (change !== void 0) this.#applyChange(change, nextSelections);
60 }
@@ -57,7 +65,7 @@ index b4c280390b52434f63fbe7916d81b150d9006fb4..8564980bdfe2ef8e17e8ab0a87627709
65 const lineAnnotations = this.#lineAnnotations?.length ?? 0;
66 const prevGutterWidth = this.#gutterWidthCache;
67 const prevContentWidth = this.#contentWidthCache;
60 -@@ -1860,12 +1878,12 @@ var Editor = class {
68 +@@ -1860,12 +1879,12 @@ var Editor = class {
69 this.#contentWidthCache = void 0;
70 const gutterWidthChanged = this.#getGutterWidth() !== prevGutterWidth;
71 const contentWidthChanged = this.#getContentWidth() !== prevContentWidth;
pnpm-lock.yaml
+5 -5
@@ -372,7 +372,7 @@ patchedDependencies:
372 '@ff-labs/fff-node@0.11.0': 93f62a76399b435a76588b2bef237db0a1e85880c1ac0d0759c416e9cc579252
373 '@legendapp/list@3.7.2': 3c68607b8bb7a531873bcbe0b197d163ef1fdb4d4cf52a4ddf9d2b3804671658
374 '@muse-code/sdk@1.4.6': 7b495b607fc5d76b444c7c4d58821e839726a30e6f3c53564f0d59f2d5b42101
375 - '@pierre/diffs@1.7.0-beta.4': dd078a7448ce6727aaaa8b8b6702fe0ff02e85f18efa7c441a768530cabbe0cc
375 + '@pierre/diffs@1.7.0-beta.4': 756e7b154f48b9084ea6630520736cf446b69e6000777f3717363836694dd00c
376 '@react-native-ai/apple@0.12.0': 2d09870c2848d185cb05b53ed823a46e12dba519324d8dd8e584e28731990f9d
377 '@react-native-menu/menu@2.0.0': 6872ba71b9847c5a0210b1b896923dadc3860faedfe28d9f062bcedfe786ef1d
378 '@react-navigation/native-stack@7.21.0': 990d575444c4af2ce8218b3b7a8280fe244c03abbdb32b822a2e862f791dbf42
@@ -573,7 +573,7 @@ importers:
573 version: 0.3.0
574 '@pierre/diffs':
575 specifier: 1.7.0-beta.4
576 - version: 1.7.0-beta.4(patch_hash=dd078a7448ce6727aaaa8b8b6702fe0ff02e85f18efa7c441a768530cabbe0cc)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
576 + version: 1.7.0-beta.4(patch_hash=756e7b154f48b9084ea6630520736cf446b69e6000777f3717363836694dd00c)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
577 '@pierre/highlights':
578 specifier: 'catalog:'
579 version: 0.5.0
@@ -1094,7 +1094,7 @@ importers:
1094 version: 1.8.0
1095 '@pierre/diffs':
1096 specifier: 1.7.0-beta.4
1097 - version: 1.7.0-beta.4(patch_hash=dd078a7448ce6727aaaa8b8b6702fe0ff02e85f18efa7c441a768530cabbe0cc)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1097 + version: 1.7.0-beta.4(patch_hash=756e7b154f48b9084ea6630520736cf446b69e6000777f3717363836694dd00c)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1098 '@pierre/trees':
1099 specifier: 1.0.0-beta.6
1100 version: 1.0.0-beta.6(@pierre/theme@2.0.0)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(shiki@4.2.0)
@@ -1510,7 +1510,7 @@ importers:
1510 dependencies:
1511 '@pierre/diffs':
1512 specifier: 1.7.0-beta.4
1513 - version: 1.7.0-beta.4(patch_hash=dd078a7448ce6727aaaa8b8b6702fe0ff02e85f18efa7c441a768530cabbe0cc)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1513 + version: 1.7.0-beta.4(patch_hash=756e7b154f48b9084ea6630520736cf446b69e6000777f3717363836694dd00c)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
1514 '@t3tools/contracts':
1515 specifier: workspace:*
1516 version: link:../contracts
@@ -16440,7 +16440,7 @@ snapshots:
16440 tslib: 2.8.1
16441 webcrypto-core: 1.9.2
16442
16443 - '@pierre/diffs@1.7.0-beta.4(patch_hash=dd078a7448ce6727aaaa8b8b6702fe0ff02e85f18efa7c441a768530cabbe0cc)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)':
16443 + '@pierre/diffs@1.7.0-beta.4(patch_hash=756e7b154f48b9084ea6630520736cf446b69e6000777f3717363836694dd00c)(@shikijs/themes@4.2.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)':
16444 dependencies:
16445 '@pierre/highlights': 0.5.1
16446 '@pierre/patches': 0.0.1
pnpm-workspace.yaml
+2 -2
@@ -248,8 +248,8 @@ patchedDependencies:
248 # scroll target a Material bottom sheet picks, so sheet content can sit below its header.
249 "@expo/ui@58.0.27": patches/@expo__ui@58.0.27.patch
250 "@ff-labs/fff-node@0.11.0": patches/@ff-labs__fff-node@0.11.0.patch
251 - # Exports the dependency-light subpaths mobile and the web diff parser import, and re-measures
252 - # editor carets when the code font changes.
251 + # Exports the dependency-light subpaths mobile and the web diff parser import, re-measures
252 + # editor carets when the code font changes, and stops the find bar reclaiming focus from the file.
253 "@pierre/diffs@1.7.0-beta.4": patches/@pierre__diffs@1.7.0-beta.4.patch
254 "@react-native-ai/apple@0.12.0": patches/@react-native-ai__apple@0.12.0.patch
255 "@react-native-menu/menu@2.0.0": patches/@react-native-menu__menu@2.0.0.patch