From e58a603949fb9e4849928dcf7d6807f572d369fa Mon Sep 17 00:00:00 2001 From: TJ Date: Thu, 20 Aug 2026 08:56:36 -0700 Subject: [PATCH] fix(site): prevent duplicate menu when right-clicking chat kebab (#28391) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right-clicking the kebab (⋮) button on a chat in the agents sidebar was showing two menus: the kebab's own dropdown **and** the row-level right-click context menu. The kebab lives inside the row's \`ContextMenuTrigger\`, so the \`contextmenu\` event on the button bubbles up and opens the row's context menu on top of the dropdown that the button already owns. Fix: swallow \`contextmenu\` on the kebab \`Button\` so only its dropdown is associated with the button. Right-clicking anywhere else on the row still opens the row context menu as before. > Generated with Coder Agents on behalf of @tracyjohnsonux. --------- Co-authored-by: Coder Agents --- .../ChatsSidebar/tree/ChatTreeNode.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx b/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx index ce2bacc0f9b..0ae6251224c 100644 --- a/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx +++ b/site/src/pages/AgentsPage/components/ChatsSidebar/tree/ChatTreeNode.tsx @@ -339,6 +339,22 @@ export const ChatTreeNode: FC = ({ chat, isChildNode }) => { isActiveChat && "opacity-100", )} aria-label={`Open actions for ${chat.title}`} + onContextMenuCapture={(e) => { + e.preventDefault(); + e.stopPropagation(); + }} + onMouseDownCapture={(e) => { + if (e.button === 2) { + e.preventDefault(); + e.stopPropagation(); + } + }} + onPointerDownCapture={(e) => { + if (e.button === 2) { + e.preventDefault(); + e.stopPropagation(); + } + }} > @@ -346,6 +362,14 @@ export const ChatTreeNode: FC = ({ chat, isChildNode }) => { { + e.preventDefault(); + e.stopPropagation(); + }} >