Status: prevent selecting text from navigating to the status

Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/901
environments/review-fix-status-l5wvx2/deployments/1456
Alex Gleason 2022-11-18 18:57:39 -06:00
rodzic 48a03ed5bd
commit dd56885d89
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -110,6 +110,11 @@ const Status: React.FC<IStatus> = (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<IStatus> = (props) => {
data-featured={featured ? 'true' : null}
aria-label={textForScreenReader(intl, actualStatus, rebloggedByText)}
ref={node}
onClick={handleClick}
onMouseUp={handleClick}
role='link'
>
{featured && (