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