[eric] voice: mic tap stops an active recording (async start ate the tap's press-end); composer mic tooltip shows the real dictation combo, not F5

This commit is contained in:
ciregenz
2026-07-28 20:46:31 -07:00
parent ec9b576615
commit ad8d9ca240
2 changed files with 7 additions and 2 deletions
@@ -1,4 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
import { comboDisplay, dictationDefaultCombo } from '@/app/pages/Settings/sections/general/ShortcutRecorderChip';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Tooltip from '@mui/material/Tooltip';
@@ -160,7 +161,7 @@ function DesktopSpawnPill({
>
<AddRounded sx={{ fontSize: 18 }} />
</Box>
<Tooltip title={recording ? 'Stop dictation' : preparing ? `Downloading voice model ${voicePct}%` : 'Dictate (F5)'} placement="top" arrow>
<Tooltip title={recording ? 'Stop dictation' : preparing ? `Downloading voice model ${voicePct}%` : `Dictate (${comboDisplay(dictationDefaultCombo())})`} placement="top" arrow>
<Box
role="button"
aria-label="Voice dictation"
@@ -24,11 +24,15 @@ export function VoiceDictationProvider({ children }: { children: React.ReactNode
const pressStart = useCallback((): void => {
if (holdMode) {
// A TAP while recording must stop: the quick tap's press-end fires before the async start
// flips state to 'recording', so without this the mic could be started by a click but never
// stopped by one.
if (stateRef.current === 'recording') { heldRef.current = false; void stop(); return; }
if (stateRef.current === 'idle') { heldRef.current = true; void start(); }
} else {
toggle();
}
}, [holdMode, start, toggle]);
}, [holdMode, start, stop, toggle]);
const pressEnd = useCallback((): void => {
if (holdMode && heldRef.current) {