fix(chat): keep mobile send from losing focus

This commit is contained in:
2026-07-01 20:00:54 +08:00
parent 1cb031f793
commit 8586e87ab6
4 changed files with 52 additions and 5 deletions
@@ -18,12 +18,14 @@ export interface ChatSendButtonProps {
disabled: boolean;
hasContent: boolean;
onClick: () => void;
onPointerDownSend: () => void;
}
export function ChatSendButton({
disabled,
hasContent,
onClick,
onPointerDownSend,
}: ChatSendButtonProps) {
return (
<button
@@ -32,6 +34,13 @@ export function ChatSendButton({
hasContent && !disabled ? styles.buttonActive : styles.buttonEmpty
}`}
disabled={disabled}
onPointerDown={(event) => {
if (event.pointerType === "mouse") return;
if (disabled) return;
event.preventDefault();
if (!hasContent) return;
onPointerDownSend();
}}
onClick={onClick}
aria-label="Send message"
>