mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-25 00:35:02 -04:00
[ENG-1791] Fix right-click sometimes opening native context menu (#2637)
resolve native context menu opening bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback, type HTMLAttributes, type PropsWithChildren } from 'react';
|
||||
import { useCallback, useEffect, type HTMLAttributes, type PropsWithChildren } from 'react';
|
||||
import {
|
||||
createSearchParams,
|
||||
useNavigate,
|
||||
@@ -215,6 +215,17 @@ export const ViewItem = ({ data, children, ...props }: ViewItemProps) => {
|
||||
|
||||
const { doubleClick } = useViewItemDoubleClick();
|
||||
|
||||
useEffect(() => {
|
||||
const handleContextMenu = (e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
document.addEventListener('contextmenu', handleContextMenu);
|
||||
return () => {
|
||||
document.removeEventListener('contextmenu', handleContextMenu);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ContextMenu.Root
|
||||
trigger={
|
||||
|
||||
Reference in New Issue
Block a user