fix(dashboard): keep mobile keyboard up when ChatView send button tapped

Re-add preventDefault on mousedown so the textarea doesn't blur when
the user taps send — keyboard stays up, no viewport reflow jumping
the input to the top of the screen. The action still runs on click
(which fires reliably from the iOS touch sequence even for quick
taps), so this preserves the previous fix's quick-tap reliability.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-06 20:19:28 -07:00
parent 0d3324ad95
commit bcfb4a3f62

View File

@@ -1994,13 +1994,17 @@ export function ChatView({ projectId, addToast }: ChatViewProps) {
<button <button
type="button" type="button"
className="chat-input-send" className="chat-input-send"
// Workaround: previous mobile flow used pointerdown + // Mobile send pattern: previous code intercepted pointerdown
// touchstart with preventDefault and a focus-preservation // and touchstart to call handleSend directly, which silently
// dance to keep the keyboard up while sending. On iOS that // dropped quick taps on iOS (only long press worked). The
// path made quick taps fail entirely (only long press // canonical iOS pattern is preventDefault on mousedown to
// registered). Falling back to plain onClick reliably fires // stop focus from leaving the textarea (keyboard stays up,
// the send on tap; the soft keyboard may dismiss but the // viewport doesn't reflow), then run the action on click.
// message goes through, which beats silent failure. // This works for quick taps because click fires reliably
// from the synthesized touch sequence.
onMouseDown={(event) => {
event.preventDefault();
}}
onClick={() => { onClick={() => {
void handleSend(); void handleSend();
}} }}