From bf7acb6eabf523deac7910984b3022619627a228 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 2 Nov 2023 08:00:00 +0800 Subject: [PATCH] Add more conditions for binding longpress Should be same condition as contextmenu --- src/components/status.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 38a79005..72519660 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -795,13 +795,16 @@ function Status({ const contextMenuRef = useRef(); const [isContextMenuOpen, setIsContextMenuOpen] = useState(false); const [contextMenuProps, setContextMenuProps] = useState({}); + + const showContextMenu = !isSizeLarge && !previewMode && !_deleted && !quoted; + const isIOS = window.ontouchstart !== undefined && /iPad|iPhone|iPod/.test(navigator.userAgent); // Only iOS/iPadOS browsers don't support contextmenu // Some comments report iPadOS might support contextmenu if a mouse is connected const bindLongPressContext = useLongPress( - isIOS + isIOS && showContextMenu ? (e) => { if (e.pointerType === 'mouse') return; // There's 'pen' too, but not sure if contextmenu event would trigger from a pen @@ -829,8 +832,6 @@ function Status({ }, ); - const showContextMenu = size !== 'l' && !previewMode && !_deleted && !quoted; - const hotkeysEnabled = !readOnly && !previewMode; const rRef = useHotkeys('r', replyStatus, { enabled: hotkeysEnabled,