Capacitor plugin to interact with screen readers.
- 🔎 Detection: Check whether a screen reader (VoiceOver/TalkBack) is currently enabled.
- 📣 Announcements: Post accessibility announcements that are read out by the active screen reader.
- 🔔 State changes: Listen for changes to the enabled state of the screen reader.
- 🖥️ Cross-platform: Supports Android, iOS and the web.
- 🤝 Compatibility: Works alongside the Accessibility Preferences and Speech Synthesis plugins.
- 🔁 Up-to-date: Always supports the latest Capacitor version.
Missing a feature? Just open an issue and we'll take a look!
Note
This plugin does not perform text-to-speech. The announce(...) method posts an accessibility announcement that is only read out when a screen reader is active. If you are looking for real text-to-speech, use the Speech Synthesis plugin instead.
The Screen Reader plugin is typically used to make apps more accessible for users of VoiceOver and TalkBack, for example:
- Accessible status updates: Announce dynamic changes such as "The item was added to your cart." that would otherwise go unnoticed by screen reader users.
- Adaptive user interfaces: Check whether a screen reader is enabled and adapt your UI accordingly, for example by simplifying gestures or animations.
- Reacting to state changes: Listen for changes to the enabled state of the screen reader and adjust your app's behavior on the fly.
- Localized announcements: Provide the language of an announcement on Android so the screen reader pronounces it correctly.
| Plugin Version | Capacitor Version | Status |
|---|---|---|
| 0.x.x | >=8.x.x | Active support |
You can use our AI-Assisted Setup to install the plugin. Add the Capawesome Skills to your AI tool using the following command:
npx skills add capawesome-team/skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-screen-reader` plugin in my project.
If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
npm install @capawesome/capacitor-screen-reader
npx cap syncNo additional configuration is required for this plugin.
No additional configuration is required for this plugin.
No configuration required for this plugin.
The following examples show how to post an accessibility announcement, check whether a screen reader is enabled, and listen for screen reader state changes.
Post an announcement that is read out by the active screen reader (VoiceOver/TalkBack). Note that this does not perform text-to-speech; the message is only read out if a screen reader is running:
import { ScreenReader } from '@capawesome/capacitor-screen-reader';
const announce = async () => {
await ScreenReader.announce({
value: 'The item was added to your cart.',
});
};Check whether a screen reader is currently enabled. Only available on Android and iOS:
import { ScreenReader } from '@capawesome/capacitor-screen-reader';
const isEnabled = async () => {
const { enabled } = await ScreenReader.isEnabled();
return enabled;
};Get notified when the screen reader is enabled or disabled. Only available on Android and iOS:
import { ScreenReader } from '@capawesome/capacitor-screen-reader';
const addStateChangeListener = async () => {
await ScreenReader.addListener('stateChange', event => {
console.log('Screen reader enabled:', event.enabled);
});
};
const removeAllListeners = async () => {
await ScreenReader.removeAllListeners();
};announce(options: AnnounceOptions) => Promise<void>Post an accessibility announcement to the active screen reader.
This does not perform text-to-speech. It posts an announcement that is read out by the screen reader (VoiceOver/TalkBack) if one is active. For real text-to-speech, use the Speech Synthesis plugin instead.
On the web, the announcement is made through a visually hidden
aria-live region, so it is only read out if the user has a screen reader
running.
| Param | Type |
|---|---|
options |
AnnounceOptions |
Since: 0.1.0
isEnabled() => Promise<IsEnabledResult>Check whether a screen reader is currently enabled.
On Android, this refers to whether touch exploration (TalkBack) is enabled. On iOS, this refers to whether VoiceOver is running.
Only available on Android and iOS.
Returns: Promise<IsEnabledResult>
Since: 0.1.0
addListener(eventName: 'stateChange', listenerFunc: (event: StateChangeEvent) => void) => Promise<PluginListenerHandle>Listen for changes to the enabled state of the screen reader.
The device is only observed while at least one listener is attached.
Only available on Android and iOS.
| Param | Type |
|---|---|
eventName |
'stateChange' |
listenerFunc |
(event: StateChangeEvent) => void |
Returns: Promise<PluginListenerHandle>
Since: 0.1.0
removeAllListeners() => Promise<void>Remove all listeners for this plugin.
Since: 0.1.0
| Prop | Type | Description | Since |
|---|---|---|---|
value |
string |
The message to announce. | 0.1.0 |
language |
string |
The language of the message as a BCP 47 language tag. This helps the screen reader pronounce the message correctly. Only available on Android. | 0.1.0 |
| Prop | Type | Description | Since |
|---|---|---|---|
enabled |
boolean |
Whether a screen reader is currently enabled. | 0.1.0 |
| Prop | Type |
|---|---|
remove |
() => Promise<void> |
| Prop | Type | Description | Since |
|---|---|---|---|
enabled |
boolean |
Whether a screen reader is currently enabled. | 0.1.0 |
This plugin is a drop-in replacement for the official @capacitor/screen-reader plugin with a few naming changes:
@capacitor/screen-reader |
Screen Reader |
|---|---|
speak({ value, language }) |
announce({ value, language }) |
isEnabled() |
isEnabled() |
addListener('stateChange', ...) |
addListener('stateChange', ...) |
The speak(...) method has been renamed to announce(...) to make it clear that it posts an accessibility announcement to the active screen reader and does not perform text-to-speech. For real text-to-speech, use the Speech Synthesis plugin instead.
It focuses on real accessibility work with VoiceOver and TalkBack: you can post announcements, check whether a screen reader is enabled, and listen for state changes, with the device observed only while a listener is attached. Announcements work on Android, iOS, and the web, where they use a visually hidden aria-live region, and on Android you can provide the announcement language so it is pronounced correctly. The API is fully typed, is actively maintained against the latest Capacitor version, and pairs naturally with the Accessibility Preferences and Speech Synthesis plugins for a complete accessibility toolkit.
No. The announce(...) method posts an accessibility announcement that is only read out by the screen reader (VoiceOver/TalkBack) if one is active. If you are looking for real text-to-speech that always speaks, use the Speech Synthesis plugin instead.
Announcements are only read out when a screen reader is active. On Android and iOS, make sure TalkBack or VoiceOver is enabled. On the Web, the announcement is made through a visually hidden aria-live region, so it is only read out if the user has a screen reader running.
No. The isEnabled() method and the stateChange listener are only available on Android and iOS. Browsers do not expose whether a screen reader is running. The announce(...) method, however, also works on the Web via an aria-live region.
This plugin is a drop-in replacement for the official @capacitor/screen-reader plugin with a few naming changes. Most notably, the speak(...) method has been renamed to announce(...) to make it clear that it posts an accessibility announcement and does not perform text-to-speech. See the migration guide above for a complete mapping.
Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
- Accessibility Preferences: Read the user's system accessibility preferences.
- Speech Synthesis: Synthesize speech from text (text-to-speech) with voice selection, pitch, and rate control.
- Text Zoom: Read and control the WebView text zoom.
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our Capawesome Newsletter.
See CHANGELOG.md.
See LICENSE.