Prompt
How do I add read-aloud voice output for accessibility?
Latest observation
Oct 11, 2026
OpenAI APIWeb search: off
To add read-aloud voice output for accessibility, you generally have two main approaches:
1) Use the browser/device’s built-in accessibility features
This is the easiest option if you’re building a web app or site.
- Make sure your content is properly structured with semantic HTML:
- Use headings (
<h1>,<h2>, etc.) - Use buttons (
<button>) instead of clickable<div>s - Add labels to form fields
- Use headings (
- Let screen readers handle the speech output automatically.
- Ensure your app works well with:
- VoiceOver (iOS/macOS)
- TalkBack (Android)
- NVDA / JAWS (Windows)
- Narrator (Windows)
2) Add text-to-speech (TTS) directly in your app
If you want the app itself to read content aloud, you can integrate a TTS API or use native browser speech synthesis.
Web example using the Web Speech API
<button onclick="readText()">Read Aloud</button>
<p id="content">This text will be spoken aloud.</p>
<script>
function readText() {
const text = document.getElementById("content").innerText;
const utterance = new SpeechSynthesisUtterance(text);
speechSynthesis.speak(utterance);
}
</script>
Important accessibility tips
- Provide a visible control to start/stop speech.
- Include a pause/stop option.
- Don’t auto-play speech without user interaction.
- Keep the reading speed adjustable if possible.
- Make sure the feature is keyboard accessible.
- Avoid duplicating content excessively if screen readers already announce it.
If you’re building for mobile or desktop
You can use platform-specific TTS:
- iOS: AVSpeechSynthesizer
- Android: TextToSpeech
- Windows/macOS: platform accessibility and speech APIs
- Electron: browser speech synthesis or OS APIs
Best practice
If your goal is accessibility, focus first on making the interface compatible with screen readers. Add custom read-aloud only when it adds value beyond standard assistive tech.
If you want, I can show you:
- a JavaScript/Web implementation,
- React version,
- or iOS/Android code.