diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 280d8df..cbfa37d 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1055,6 +1055,18 @@ function Flow() { setContextMenu({ x: event.clientX, y: event.clientY }); }, []); + useEffect(() => { + if (!contextMenu) return undefined; + + const handlePointerDown = (event) => { + if (event.target.closest('.context-menu')) return; + setContextMenu(null); + }; + + window.addEventListener('pointerdown', handlePointerDown, true); + return () => window.removeEventListener('pointerdown', handlePointerDown, true); + }, [contextMenu]); + // ── Render ────────────────────────────────────────────────────────── return ( @@ -1089,9 +1101,7 @@ function Flow() { {/* React Flow canvas */} -