From ab0472de021faad85600814a3fb38d768de74edf Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Fri, 1 Mar 2024 10:29:38 +0800 Subject: [PATCH] Fix some links not opening browser's context menu --- src/components/status.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 5c8f6f36..6dc70de7 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -1085,7 +1085,7 @@ function Status({ const { clientX, clientY } = e.touches?.[0] || e; // link detection copied from onContextMenu because here it works const link = e.target.closest('a'); - if (link && /^https?:\/\//.test(link.getAttribute('href'))) return; + if (link && statusRef.current.contains(link)) return; e.preventDefault(); setContextMenuProps({ anchorPoint: { @@ -1331,7 +1331,7 @@ function Status({ if (e.metaKey) return; // console.log('context menu', e); const link = e.target.closest('a'); - if (link && /^https?:\/\//.test(link.getAttribute('href'))) return; + if (link && statusRef.current.contains(link)) return; // If there's selected text, don't show custom context menu const selection = window.getSelection?.();