We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c7a5d09 + 7f397c7 commit 3b60b76Copy full SHA for 3b60b76
package/ContextMenuProvider.tsx
@@ -52,12 +52,20 @@ export function ContextMenuProvider({
52
setData(null);
53
};
54
55
- const showContextMenu: ShowContextMenuFunction = (content, options) => (e) => {
+ const showContextMenu: ShowContextMenuFunction = (content, options) => (e: React.MouseEvent | React.TouchEvent) => {
56
e.preventDefault();
57
e.stopPropagation();
58
+
59
+ const x = "touches" in e
60
+ ? e.touches[0].clientX
61
+ : e.clientX;
62
+ const y = "touches" in e
63
+ ? e.touches[0].clientY
64
+ : e.clientY;
65
66
setData({
- x: e.clientX,
- y: e.clientY,
67
+ x,
68
+ y,
69
content,
70
zIndex: options?.zIndex || zIndex,
71
className: options?.className,
0 commit comments