feat: implement voice search overlay with microphone icon

This commit is contained in:
Peter Wood
2025-04-23 07:44:24 -04:00
parent 0f6cfe3d6c
commit b0235e3fd7
3 changed files with 28 additions and 0 deletions

View File

@@ -177,6 +177,17 @@ pokemonNameInput.addEventListener("keypress", (event) => {
}
});
// Show a dimmed overlay with a large microphone icon when the voice search button is clicked
voiceSearchButton.addEventListener("click", () => {
const voiceOverlay = document.getElementById("voiceOverlay");
voiceOverlay.classList.remove("hidden");
// Simulate listening for 3 seconds, then hide the overlay
setTimeout(() => {
voiceOverlay.classList.add("hidden");
}, 3000);
});
const SpeechRecognition =
window.SpeechRecognition || window.webkitSpeechRecognition;
let recognition;