From 6b4d64a6507e1950bce0501e49d88dc6cd19166c Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sat, 18 Oct 2025 16:42:23 +0000 Subject: [PATCH] fix: improve mobile touch event handling for Roo Cloud interaction - Added touch-manipulation CSS to Button component for better mobile responsiveness - Added onTouchEnd handlers to FollowUpSuggest buttons to prevent ghost clicks - Added touch event handlers to all interactive buttons in ChatTextArea - Ensured clipboard copy button in follow-up suggestions is accessible on mobile This fixes the issue where users couldn't select answers or send messages on Roo Cloud mobile interface. --- .../src/components/chat/ChatTextArea.tsx | 34 ++++++++++++++++--- .../src/components/chat/FollowUpSuggest.tsx | 22 ++++++++++-- webview-ui/src/components/ui/button.tsx | 2 +- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index c7813372fa79..42138b9e805e 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -1090,13 +1090,21 @@ export const ChatTextArea = forwardRef( aria-label={t("chat:addImages")} disabled={shouldDisableImages} onClick={!shouldDisableImages ? onSelectImages : undefined} + onTouchEnd={ + !shouldDisableImages + ? (e) => { + e.preventDefault() + onSelectImages() + } + : undefined + } className={cn( "relative inline-flex items-center justify-center", "bg-transparent border-none p-1.5", "rounded-md min-w-[28px] min-h-[28px]", "text-vscode-descriptionForeground hover:text-vscode-foreground", "transition-all duration-1000", - "cursor-pointer", + "cursor-pointer touch-manipulation", !shouldDisableImages ? "opacity-50 hover:opacity-100 delay-750 pointer-events-auto" : "opacity-0 pointer-events-none duration-200 delay-0", @@ -1115,13 +1123,17 @@ export const ChatTextArea = forwardRef( aria-label={t("chat:enhancePrompt")} disabled={false} onClick={handleEnhancePrompt} + onTouchEnd={(e) => { + e.preventDefault() + handleEnhancePrompt() + }} className={cn( "relative inline-flex items-center justify-center", "bg-transparent border-none p-1.5", "rounded-md min-w-[28px] min-h-[28px]", "text-vscode-descriptionForeground hover:text-vscode-foreground", "transition-all duration-1000", - "cursor-pointer", + "cursor-pointer touch-manipulation", hasInputContent ? "opacity-50 hover:opacity-100 delay-750 pointer-events-auto" : "opacity-0 pointer-events-none duration-200 delay-0", @@ -1139,6 +1151,10 @@ export const ChatTextArea = forwardRef( aria-label={t("chat:cancel.title")} disabled={false} onClick={onCancel} + onTouchEnd={(e) => { + e.preventDefault() + onCancel?.() + }} className={cn( "relative inline-flex items-center justify-center", "bg-transparent border-none p-1.5", @@ -1148,7 +1164,7 @@ export const ChatTextArea = forwardRef( "hover:bg-[rgba(255,255,255,0.03)] hover:border-[rgba(255,255,255,0.15)]", "focus:outline-none focus-visible:ring-1 focus-visible:ring-vscode-focusBorder", "active:bg-[rgba(255,255,255,0.1)]", - "cursor-pointer", + "cursor-pointer touch-manipulation", )}> @@ -1159,6 +1175,10 @@ export const ChatTextArea = forwardRef( aria-label={t("chat:sendMessage")} disabled={false} onClick={onSend} + onTouchEnd={(e) => { + e.preventDefault() + onSend() + }} className={cn( "relative inline-flex items-center justify-center", "bg-transparent border-none p-1.5", @@ -1172,7 +1192,7 @@ export const ChatTextArea = forwardRef( "hover:bg-[rgba(255,255,255,0.03)] hover:border-[rgba(255,255,255,0.15)]", "focus:outline-none focus-visible:ring-1 focus-visible:ring-vscode-focusBorder", hasInputContent && "active:bg-[rgba(255,255,255,0.1)]", - hasInputContent && "cursor-pointer", + hasInputContent && "cursor-pointer touch-manipulation", )}> @@ -1244,6 +1264,10 @@ export const ChatTextArea = forwardRef( diff --git a/webview-ui/src/components/chat/FollowUpSuggest.tsx b/webview-ui/src/components/chat/FollowUpSuggest.tsx index d18ccc251735..950d8403bf4d 100644 --- a/webview-ui/src/components/chat/FollowUpSuggest.tsx +++ b/webview-ui/src/components/chat/FollowUpSuggest.tsx @@ -113,8 +113,13 @@ export const FollowUpSuggest = ({ className="bg-vscode-editor-background rounded-sm w-full relative group">