fix(FN-xxx): send quick chat message on first mobile tap
This commit is contained in:
5
.changeset/fix-quick-chat-mobile-send-tap.md
Normal file
5
.changeset/fix-quick-chat-mobile-send-tap.md
Normal 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.
|
||||
@@ -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();
|
||||
}}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user