diff --git a/web/src/components/ChatList.tsx b/web/src/components/ChatList.tsx index 7dbaf00..4db7858 100644 --- a/web/src/components/ChatList.tsx +++ b/web/src/components/ChatList.tsx @@ -42,6 +42,7 @@ export function ChatList() { const sidebarRef = useRef(null); const burgerMenuRef = useRef(null); const burgerButtonRef = useRef(null); + const ctxMenuRef = useRef(null); const deleteModalChat = chats.find((chat) => chat.id === deleteModalChatId) ?? null; const canDeleteForEveryone = Boolean( deleteModalChat && @@ -168,8 +169,11 @@ export function ChatList() { const onPointerDown = (event: MouseEvent) => { const target = event.target as Node | null; if (ctxChatId) { - setCtxChatId(null); - setCtxPos(null); + const inCtxMenu = ctxMenuRef.current?.contains(target ?? null) ?? false; + if (!inCtxMenu) { + setCtxChatId(null); + setCtxPos(null); + } } if (menuOpen) { const inMenu = burgerMenuRef.current?.contains(target ?? null) ?? false; @@ -608,7 +612,7 @@ export function ChatList() { {ctxChatId && ctxPos ? createPortal(
{ setCtxChatId(null); setCtxPos(null); }}> -
e.stopPropagation()}> +
e.stopPropagation()}>