From dd56885d89b9864d35be72fd734897ba571c4217 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 18 Nov 2022 18:57:39 -0600 Subject: [PATCH] Status: prevent selecting text from navigating to the status Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/901 --- app/soapbox/components/status.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/soapbox/components/status.tsx b/app/soapbox/components/status.tsx index 812d915ead..846735dc3c 100644 --- a/app/soapbox/components/status.tsx +++ b/app/soapbox/components/status.tsx @@ -110,6 +110,11 @@ const Status: React.FC = (props) => { const handleClick = (e?: React.MouseEvent): void => { e?.stopPropagation(); + // If the user is selecting text, don't focus the status. + if (getSelection()?.toString().length) { + return; + } + if (!e || !(e.ctrlKey || e.metaKey)) { if (onClick) { onClick(); @@ -321,7 +326,7 @@ const Status: React.FC = (props) => { data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, actualStatus, rebloggedByText)} ref={node} - onClick={handleClick} + onMouseUp={handleClick} role='link' > {featured && (