From 59823a05f9ee13bb43afef29ccee449bf93f7775 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 31 Jan 2023 18:22:09 +0100 Subject: [PATCH] Text Formatter: Enlarge area for triggering (#2461) --- src/components/middle/composer/MessageInput.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/middle/composer/MessageInput.tsx b/src/components/middle/composer/MessageInput.tsx index f5775388c..2118e0a61 100644 --- a/src/components/middle/composer/MessageInput.tsx +++ b/src/components/middle/composer/MessageInput.tsx @@ -36,6 +36,7 @@ const FOCUS_DELAY_MS = 350; const TRANSITION_DURATION_FACTOR = 50; const SCROLLER_CLASS = 'input-scroller'; +const INPUT_WRAPPER_CLASS = 'message-input-wrapper'; type OwnProps = { id: string; @@ -277,7 +278,9 @@ const MessageInput: FC = ({ function handleMouseDown(e: React.MouseEvent) { if (e.button !== 2) { - e.target.addEventListener('mouseup', processSelectionWithTimeout, { once: true }); + const listenerEl = e.currentTarget.closest(`.${INPUT_WRAPPER_CLASS}`) || e.target; + + listenerEl.addEventListener('mouseup', processSelectionWithTimeout, { once: true }); return; }