From c043939bf89284f7d79adcacaca6af4391bc5632 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Tue, 9 Jun 2026 15:55:17 -0400 Subject: [PATCH] Fix project action menu click handling (#5041) --- .../src/components/sidebar/WorktreeList.tsx | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/sidebar/WorktreeList.tsx b/src/renderer/src/components/sidebar/WorktreeList.tsx index 6a81a12be..f3ac35f8c 100644 --- a/src/renderer/src/components/sidebar/WorktreeList.tsx +++ b/src/renderer/src/components/sidebar/WorktreeList.tsx @@ -301,6 +301,10 @@ function handleRepoHeaderActionPointerDown(event: React.PointerEvent): void { + event.stopPropagation() +} + function shouldIgnoreRepoHeaderToggle(event: React.SyntheticEvent): boolean { return isRepoHeaderActionTarget(event.target, event.currentTarget) } @@ -3014,7 +3018,15 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp align="end" side="bottom" sideOffset={6} - onClick={(event) => event.stopPropagation()} + // Why: Radix portals preserve React bubbling through + // the project header. Keep menu interactions from + // arming row drag/collapse handlers behind it. + onPointerDown={stopRepoHeaderMenuEvent} + onMouseDown={stopRepoHeaderMenuEvent} + onPointerUp={stopRepoHeaderMenuEvent} + onMouseUp={stopRepoHeaderMenuEvent} + onClick={stopRepoHeaderMenuEvent} + onKeyDown={stopRepoHeaderMenuEvent} > { @@ -3064,7 +3076,15 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp align="end" side="bottom" sideOffset={6} - onClick={(event) => event.stopPropagation()} + // Why: Radix portals preserve React bubbling through + // the project header. Keep menu interactions from + // arming row drag/collapse handlers behind it. + onPointerDown={stopRepoHeaderMenuEvent} + onMouseDown={stopRepoHeaderMenuEvent} + onPointerUp={stopRepoHeaderMenuEvent} + onMouseUp={stopRepoHeaderMenuEvent} + onClick={stopRepoHeaderMenuEvent} + onKeyDown={stopRepoHeaderMenuEvent} > {