Skip to content

Prevent touch submit from starting voice input - #3420

Merged
ymichael merged 1 commit into
mainfrom
bb/investigate-mobile-submit-starting-voice-recordi-thr_kac4gk3kqg
Sep 10, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/investigate-mobile-submit-starting-voice-recordi-thr_kac4gk3kqg

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

On coarse-pointer devices, follow-up submission happens on pointer-up. Sending clears the composer immediately, replacing the Submit button with the microphone button before the browser dispatches the tap compatibility click. That trailing click is hit-tested against the replacement microphone control and starts recording even though the gesture began on Submit.

What changed

Voice activation now records the exact microphone button that received pointer-down and ignores pointer-driven clicks retargeted to a different replacement button. Deliberate microphone taps, mouse clicks, and keyboard or assistive activation remain supported, and touch submission still keeps its pointer-up latency improvement.

How you verified

  • Focused Turbo PromptBoxInternal suite: 121/121 tests passed.
  • Added regressions for a retargeted touch-submit click, a deliberate microphone tap, and keyboard activation.
  • Turbo app typecheck passed.
  • Formatting and git diff checks passed.
  • Browser QA reproduced the original compatibility-click target and confirmed one-tap submit sends without requesting the microphone, while a deliberate microphone tap still starts recording.

AGENT GENERATED

On a coarse pointer the follow-up composer submits on `pointerup` and then
swaps the primary action from Submit to the microphone in the same commit.
The browser's trailing compatibility `click` is hit-tested after that swap, so
it lands on the replacement microphone button, whose handler had no guard and
started a recording. A single tap therefore sent the message and opened the
microphone.

Only activate voice from a click whose gesture began on that same control:
record the button on `pointerdown` and ignore pointer-driven clicks
(`detail > 0`) whose `currentTarget` does not match. Keyboard activation
(`detail === 0`) is unaffected, and voice still starts inside the synchronous
user gesture that `getUserMedia` requires.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ymichael
ymichael force-pushed the bb/investigate-mobile-submit-starting-voice-recordi-thr_kac4gk3kqg branch from 6cacbe8 to 26f4f8f Compare September 10, 2026 17:02
@ymichael
ymichael merged commit 6dd0651 into main Sep 10, 2026
16 checks passed
@ymichael
ymichael deleted the bb/investigate-mobile-submit-starting-voice-recordi-thr_kac4gk3kqg branch September 10, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant