From 9596ed072b90d3e29af749a65fa662989c3025e9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 13 Apr 2022 17:37:38 -0500 Subject: [PATCH] EmojiButtonWrapper: improve touch behavior --- app/soapbox/components/emoji-button-wrapper.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/soapbox/components/emoji-button-wrapper.tsx b/app/soapbox/components/emoji-button-wrapper.tsx index 32159b329..1dad15dc7 100644 --- a/app/soapbox/components/emoji-button-wrapper.tsx +++ b/app/soapbox/components/emoji-button-wrapper.tsx @@ -44,13 +44,19 @@ const EmojiButtonWrapper: React.FC = ({ statusId, children if (!status) return null; const handleMouseEnter = () => { - setVisible(true); + if (!isUserTouching()) { + setVisible(true); + } }; const handleMouseLeave = () => { setVisible(false); }; + const handleUnfocus = () => { + setVisible(false); + }; + const handleReact = (emoji: string): void => { if (ownAccount) { dispatch(simpleEmojiReact(status, emoji)); @@ -77,6 +83,7 @@ const EmojiButtonWrapper: React.FC = ({ statusId, children handleReact(meEmojiReact); } + e.preventDefault(); e.stopPropagation(); }; @@ -106,6 +113,7 @@ const EmojiButtonWrapper: React.FC = ({ statusId, children
{React.cloneElement(children, { onClick: handleClick, + onBlur: handleUnfocus, ref, })}