The best way to control Claude Code, Codex and more from any computer or phone
refactor(web): pull requests Cmd+F focuses the topbar search directly (#26045)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 27, 2026 at 11:19 UTC
21762b5d4d1b4188a217293d050eb154afa80d95
1 file changed
+5
-19
apps/web/src/components/pullRequest/PullRequestsColumn.tsx
+5
-19
@@ -22,14 +22,12 @@ function ExpandableSearch({
22
searchValue,
23
open,
24
onOpenChange,
25
- focusToken,
25
onFocusWithin,
26
}: {
27
searchInput: ReactNode;
28
searchValue: string;
29
open: boolean;
30
onOpenChange: (open: boolean) => void;
32
- focusToken: number;
31
/**
32
* An unmount fires no blur, which is the point: whoever unmounted this can still see the reader
33
* was mid-typing and move the focus somewhere that continues the sentence.
@@ -41,14 +39,6 @@ function ExpandableSearch({
39
if (!open) return;
40
containerRef.current?.querySelector("input")?.focus();
41
}, [open]);
44
- const appliedFocusToken = useRef(focusToken);
45
- useEffect(() => {
46
- if (appliedFocusToken.current === focusToken) return;
47
- appliedFocusToken.current = focusToken;
48
- const input = containerRef.current?.querySelector("input");
49
- input?.focus();
50
- input?.select();
51
- }, [focusToken]);
42
if (open || searchValue.length > 0) {
43
return (
44
<div
@@ -134,7 +124,7 @@ export function PullRequestsColumn({
124
const topbarSearchFocusedRef = useRef(false);
125
const inFlowSearchRef = useRef<HTMLDivElement | null>(null);
126
const [searchOpen, setSearchOpen] = useState(false);
137
- const [searchFocusToken, setSearchFocusToken] = useState(0);
127
+ const topbarSearchRef = useRef<HTMLDivElement | null>(null);
128
const searchExpanded = searchOpen || searchValue.length > 0;
129
useEffect(() => {
130
const onKeyDown = (event: KeyboardEvent) => {
@@ -142,12 +132,9 @@ export function PullRequestsColumn({
132
if (event.key.toLowerCase() !== "f" || !(event.metaKey || event.ctrlKey)) return;
133
if (event.altKey || event.shiftKey) return;
134
event.preventDefault();
145
- if (condensed) {
146
- setSearchOpen(true);
147
- setSearchFocusToken((token) => token + 1);
148
- return;
149
- }
150
- const input = inFlowSearchRef.current?.querySelector("input");
135
+ // A closed topbar search has no input yet; opening it mounts one that focuses itself.
136
+ if (condensed) setSearchOpen(true);
137
+ const input = (condensed ? topbarSearchRef : inFlowSearchRef).current?.querySelector("input");
138
input?.focus();
139
input?.select();
140
};
@@ -217,13 +204,12 @@ export function PullRequestsColumn({
204
)}
205
<div className="min-w-0 flex-1" />
206
{condensed ? (
220
- <div className="flex shrink items-center gap-1.5">
207
+ <div ref={topbarSearchRef} className="flex shrink items-center gap-1.5">
208
<ExpandableSearch
209
searchInput={searchInput}
210
searchValue={searchValue}
211
open={searchOpen}
212
onOpenChange={setSearchOpen}
226
- focusToken={searchFocusToken}
213
onFocusWithin={(focused) => {
214
topbarSearchFocusedRef.current = focused;
215
}}