[Web][Backend] Voice command accessibility mode -> Web Speech API + preference endpoint (closes #287, #286)#617
Open
mustafa-5493 wants to merge 13 commits into
Open
[Web][Backend] Voice command accessibility mode -> Web Speech API + preference endpoint (closes #287, #286)#617mustafa-5493 wants to merge 13 commits into
mustafa-5493 wants to merge 13 commits into
Conversation
b759044 to
b28be73
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Closes #287 and parent #286. Implements requirement 1.1.3.8 end-to-end:
Backend
voiceCommandsEnabledboolean column onRegisteredUser(default false) + V6 Flyway migrationVoiceCommandsRequestDTO +RegisteredUserService.setVoiceCommandsEnabledPATCH /api/users/me/voice-commands(mirrors the leaderboard-visibility pattern)voiceCommandsEnabledsurfaced inUserProfileDTOso the web client reads it via/meWeb
parseVoiceCommand-> pure deterministic parser: zoom in/out, my location, find/search<q>, navigate to/go to<X>, report (<cat>) hereuseSpeechRecognition-> thin React wrapper overwindow.SpeechRecognition/webkitSpeechRecognition, auto re-arms on quiet pauses, cleans up on unmount, surfaces errors as stateVoiceCommandContext-> app-level{ active, lastEvent }state bridging the navbar mic toggle and the per-page command runnerVoiceCommandRunner-> lives inside the LeafletMapContainer; dispatches recognized commands to existing Home setters (map.zoomIn(),setSearchTarget,setRouteDest,setShowCreatePanel, etc.) so a voice command is exactly equivalent to the click pathVoiceCommandMicButton-> navbar pill; hidden when feature unsupported or user hasn't opted in. Animates while listening (respectsprefers-reduced-motionviamotion-safe:)VoiceCommandLiveRegion-> visually-hidden polite ARIA region; announces "Heard: …" / "Zoom in" / "Command not recognized: …" / errors/profilewith a toggle callinguseSetVoiceCommandsEnabled; unsupported-browser notice rendered inline whenwindow.SpeechRecognitionis missing📊 Type
New feature
✅ Acceptance Criteria
/profile; setting persists to backend and restores on next login from/api/users/me🧪 How to Test
Automated
Manual (Chrome or Edge required for Web Speech API)
docker compose -f docker-compose.local.yml --env-file backend/.env up -d --build/profile→ Accessibility section → enable "Voice commands"📸 Screenshots
⏱️ Estimated Review Time
15 min (commit-by-commit on the Commits tab -> 12 atomic commits cover backend column → DTO → service → endpoint → tests → parser → hook → context → service-call → mic UI → runner → settings toggle)