fix(composer): move the mobile dictation button off the floating controls

On mobile the dictation button sat at the right edge of the composer, directly
below the floating cluster (Stop, Clear, TTS pill) anchored to the composer's
top-right corner, so the two were adjacent touch targets. Render the dictation
button ahead of the composer tools menu so it takes the slot one position left.

The reorder exposed a latent bug: renderVoiceButton attaches the same
voiceButtonContainerRef for both variants, so the last one rendered owns it.
The desktop variant is always rendered (CSS-hidden below md), so moving the
mobile variant first handed the ref to the desktop container and the
outside-press guard stopped recognising the mic, ending the recording on the
first tap. Render the desktop variant only at desktop widths so exactly one
voice container exists in the DOM.
This commit is contained in:
Chris Scott committed 2026-10-12 17:01:02 -04:00
1 parent 377e3c2784
commit 93faf387d2
1 file changed
+4 -4
@@ -1648,6 +1648,9 @@ return (
>
<Upload className="w-5 h-5" />
</button>
{showMobileVoiceButton && (
renderVoiceButton('mobile')
)}
{isMobile && directory && (
<ComposerToolsMenu
sessionID={sessionID}
@@ -1660,12 +1663,9 @@ return (
onDictate={canUseMobileVoice && hasPromptContent && !showVoiceFeedback ? () => void startVoiceRecording() : undefined}
/>
)}
{sttEnabled && sttSupported && (
{!isMobile && sttEnabled && sttSupported && (
renderVoiceButton('desktop')
)}
{showMobileVoiceButton && (
renderVoiceButton('mobile')
)}
{!showMobileVoiceButton && (
<button
data-submit-prompt