- Issue created by @jessebaker
- First commit to issue fork.
- Merge request !762Issue #3506657: Find a better way to close the Radix context/right click menu. โ (Open) created by Unnamed author
- ๐ฎ๐ณIndia hitvikav_
issue #3506657: I have added possible mouse events on which menu should be closed.
Raised MR for a better way to close the Radix context/right click menu
Thanks - ๐ฎ๐ณIndia meghasharma
Instead of directly manipulating the DOM using document.querySelector and menu.style.display = 'none' (lines 84 and 88), we should use Radix UIโs built-in method (if available) to close the menu.
Can we avoid direct DOM manipulation? Radix UI might change internal class names, which can break the code.
Can we use state for menu visibility? The menuโs visibility should be controlled using useState.const [open, setOpen] = useState(true); // Control menu state const closeContextMenu = useCallback(() => { setOpen(false); // Close the menu using state }, []);