fix(FN-xxx): send quick chat message on first mobile tap

This commit is contained in:
gsxdsm
2026-05-01 06:48:13 -07:00
parent ecabab86ed
commit 72dffe4f33
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix Quick Chat mobile send button so the first tap while keyboard is open sends the message instead of only dismissing the keyboard.

View File

@@ -2035,6 +2035,11 @@ export function QuickChatFAB({
<button
type="button"
className="chat-input-stop quick-chat-send-btn"
onTouchStart={(event) => {
if (typeof window === "undefined" || window.innerWidth > QUICK_CHAT_DESKTOP_BREAKPOINT) return;
event.preventDefault();
stopStreaming();
}}
onClick={stopStreaming}
aria-label="Stop generation"
data-testid="quick-chat-stop"
@@ -2045,6 +2050,11 @@ export function QuickChatFAB({
<button
type="button"
className="quick-chat-send-btn"
onTouchStart={(event) => {
if (typeof window === "undefined" || window.innerWidth > QUICK_CHAT_DESKTOP_BREAKPOINT) return;
event.preventDefault();
void handleSendMessage();
}}
onClick={() => {
void handleSendMessage();
}}

View File

@@ -2138,6 +2138,29 @@ describe("QuickChatFAB", () => {
});
});
it("sends on first touch tap on mobile without requiring a second tap", async () => {
mockMobileVisualViewport({
innerHeight: 800,
vvHeight: 800,
});
render(<QuickChatFAB addToast={addToast} open={true} onOpenChange={vi.fn()} projectId="proj-123" />);
const input = await screen.findByTestId("quick-chat-input");
await waitFor(() => {
expect(input).not.toBeDisabled();
});
fireEvent.change(input, { target: { value: "send from touch" } });
const sendButton = screen.getByTestId("quick-chat-send");
fireEvent.touchStart(sendButton);
await waitFor(() => {
expect(mockStreamChatResponse).toHaveBeenCalledTimes(1);
});
});
it("does not subscribe to keyboard tracking while panel is closed", async () => {
const { mockVV } = mockMobileVisualViewport({
innerHeight: 800,