refactor: migrate touch and mouse click handling to native onClick event to improve interaction reliability
This commit is contained in:
@@ -82,7 +82,7 @@ function EventItem({
|
|||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
cancelPress();
|
cancelPress();
|
||||||
if (!isLongPress.current && !isScrolling.current) {
|
if (!isLongPress.current) {
|
||||||
onClick();
|
onClick();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -107,12 +107,13 @@ function EventItem({
|
|||||||
WebkitUserSelect: "none",
|
WebkitUserSelect: "none",
|
||||||
}}
|
}}
|
||||||
onTouchStart={startPress}
|
onTouchStart={startPress}
|
||||||
onTouchEnd={handleClick}
|
onTouchEnd={cancelPress}
|
||||||
onTouchMove={handleTouchMove}
|
onTouchMove={handleTouchMove}
|
||||||
onTouchCancel={cancelPress}
|
onTouchCancel={cancelPress}
|
||||||
onMouseDown={startPress}
|
onMouseDown={startPress}
|
||||||
onMouseUp={handleClick}
|
onMouseUp={cancelPress}
|
||||||
onMouseLeave={cancelPress}
|
onMouseLeave={cancelPress}
|
||||||
|
onClick={handleClick}
|
||||||
onContextMenu={(e) => e.preventDefault()} // Prevent context menu on long press
|
onContextMenu={(e) => e.preventDefault()} // Prevent context menu on long press
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user