From 4c579689147039eeb82ec3725a7e17c022904e04 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 19 Nov 2022 15:30:09 -0600 Subject: [PATCH] StatusContent: prevent bubbling of mentions, links, hashtags, and "Read more" button --- app/soapbox/components/status-content.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/soapbox/components/status-content.tsx b/app/soapbox/components/status-content.tsx index a495a9f82..2b2754176 100644 --- a/app/soapbox/components/status-content.tsx +++ b/app/soapbox/components/status-content.tsx @@ -12,6 +12,7 @@ import { isRtl } from '../rtl'; import Poll from './polls/poll'; import './status-content.css'; +import StopPropagation from './stop-propagation'; import type { Status, Mention } from 'soapbox/types/entities'; @@ -29,10 +30,12 @@ interface IReadMoreButton { /** Button to expand a truncated status (due to too much content) */ const ReadMoreButton: React.FC = ({ onClick }) => ( - + + + ); interface IStatusContent { @@ -103,6 +106,10 @@ const StatusContent: React.FC = ({ status, onClick, collapsable link.setAttribute('title', link.href); link.addEventListener('click', onLinkClick.bind(link), false); } + + // Prevent bubbling + link.addEventListener('mouseup', e => e.stopPropagation()); + link.addEventListener('mousedown', e => e.stopPropagation()); }); };