Closed iamkarshe closed 2 months ago
Either we update mouse hook to detect right click or have one more hook for right click event detection, even we can add context menu if required?
Existing mouse hook. https://hooks.scriptkavi.com/docs/hooks/mouse
After update we might have
const [mouse, ref] = useMouse() // Either if (mouse.isRightClick) {} // Or, if (mouse.clickType === 'RIGHT_CLICK') {}
Mouse
Though we have onContextMenu event already in React. Should we make hook around it?
onContextMenu
import React from 'react'; const RightClickComponent = () => { const handleRightClick = (event) => { event.preventDefault(); // Prevent the default context menu from appearing console.log('Right-click detected'); // You can add your custom context menu logic here }; return ( <div onContextMenu={handleRightClick} style={{ width: '300px', height: '200px', backgroundColor: '#ffffff', border: '2px solid #000', display: 'flex', justifyContent: 'center', alignItems: 'center', fontSize: '1.5rem', textAlign: 'center', margin: '50px auto' }} > Right-click here! </div> ); }; export default RightClickComponent;
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.
Feature description
Either we update mouse hook to detect right click or have one more hook for right click event detection, even we can add context menu if required?
Existing mouse hook. https://hooks.scriptkavi.com/docs/hooks/mouse
After update we might have
Affected component/components
Mouse
Additional Context
Though we have
onContextMenu
event already in React. Should we make hook around it?Before submitting