From 1749d3f3925c568f19cebbe49e6db5ade5ecca3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Sun, 10 May 2026 18:34:18 +0800 Subject: [PATCH] fix(desktop): fix right-click context menu not working on sidebar conversation items - Skip startDragging() on right-click to prevent Tauri IPC from disrupting the contextmenu event on macOS - Allow context menu to render when sidebar is collapsed - Fix auto-dismiss effect to not self-clear contextMenu state --- desktop/src/components/layout/Sidebar.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/desktop/src/components/layout/Sidebar.tsx b/desktop/src/components/layout/Sidebar.tsx index ff8f87e1..0211c4ca 100644 --- a/desktop/src/components/layout/Sidebar.tsx +++ b/desktop/src/components/layout/Sidebar.tsx @@ -45,9 +45,10 @@ export function Sidebar({ isMobile = false, onRequestClose }: SidebarProps) { }, [fetchSessions]) useEffect(() => { - if (!contextMenu || sidebarOpen) return - setContextMenu(null) - }, [contextMenu, sidebarOpen]) + if (!contextMenu) return + if (!sidebarOpen) setContextMenu(null) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [sidebarOpen]) useEffect(() => { if (!contextMenu) return @@ -116,6 +117,7 @@ export function Sidebar({ isMobile = false, onRequestClose }: SidebarProps) { }, []) const handleSidebarDrag = useCallback((e: React.MouseEvent) => { + if (e.button !== 0) return if ((e.target as HTMLElement).closest('button, input, textarea, select, a, [role="button"]')) return startDraggingRef.current?.() }, []) @@ -379,7 +381,7 @@ export function Sidebar({ isMobile = false, onRequestClose }: SidebarProps) { )} - {contextMenu && sidebarOpen && ( + {contextMenu && (