diff --git a/client/src/App.jsx b/client/src/App.jsx index 4fe1c62..c25b2b6 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -250,6 +250,17 @@ function App() { } }, []); + // Hook to hide the menu when user click elsewhere on the screen + useEffect(() => { + const canvas = document.getElementById("canvas"); + canvas.addEventListener("click", () => { + console.log("clicked"); + if (showMenu) { + setShowMenu(false); + } + }) + }, [showMenu]); + return (