diff --git a/client/src/components/Input/SpeechRecognition.tsx b/client/src/components/Input/SpeechRecognition.tsx index 26cfec7dc4..d232bf5f91 100644 --- a/client/src/components/Input/SpeechRecognition.tsx +++ b/client/src/components/Input/SpeechRecognition.tsx @@ -65,6 +65,22 @@ const useSpeechRecognition = (ask) => { } }; + const handleKeyDown = (event) => { + if (e.shiftKey && e.altKey && e.key === 'L') { + if (isSpeechSupported) { + toggleListening(); + } + } + }; + + useEffect(() => { + window.addEventListener('keydown', handleKeyDown); + + return () => { + window.removeEventListener('keydown', handleKeyDown); + }; + }, [isListening]); + return { isSpeechSupported, isListening, text, toggleListening }; };