@devries-cameron20 / t3code-1 / commits / 3e61886a24
Fork 0

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

refactor(web): file browser records the right-click position on its own panel (#25908)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 27, 2026 at 05:17 UTC 3e61886a243bf8775e2331f558340074ea5f89f0
1 file changed +4 -7
apps/web/src/components/files/FileBrowserPanel.tsx
+4 -7
@@ -173,13 +173,6 @@ export default function FileBrowserPanel({
173
174 // Shadow-DOM row rects are unreliable; capture the composed contextmenu event's viewport position.
175 const contextMenuPointerRef = useRef<{ x: number; y: number; at: number } | null>(null);
176 - useEffect(() => {
177 - const capturePointer = (event: MouseEvent) => {
178 - contextMenuPointerRef.current = { x: event.clientX, y: event.clientY, at: event.timeStamp };
179 - };
180 - document.addEventListener("contextmenu", capturePointer, true);
181 - return () => document.removeEventListener("contextmenu", capturePointer, true);
182 - }, []);
176
177 const showEntryContextMenu = useStableCallback(
178 (item: TreeContextMenuItem, context: TreeContextMenuOpenContext) => {
@@ -493,6 +486,10 @@ export default function FileBrowserPanel({
486 ref={panelRef}
487 className="flex min-h-0 flex-1 flex-col bg-background"
488 data-file-browser-panel={`${environmentId}:${cwd}`}
489 + // Capture runs before the tree's shadow-internal row handler opens the menu.
490 + onContextMenuCapture={(event) => {
491 + contextMenuPointerRef.current = { x: event.clientX, y: event.clientY, at: event.timeStamp };
492 + }}
493 >
494 <div
495 className="flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-1 in-data-[preview-panel-mode=inline]:h-9 in-data-[preview-panel-mode=inline]:min-h-9 in-data-[preview-panel-mode=inline]:border-b-transparent"