You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/accessibility/announcer.md
+20-35Lines changed: 20 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,26 @@
1
-
# Announcer Mixin
1
+
# Announcer Library
2
2
3
-
Extend your app with the `Announcer` class, that when enabled, allows for relevant information to be voiced along the focus path of the application. On Focus Change events, the `Announcer` class traverses the `_focusPath` property collecting strings or promises of strings to announce to the user. The array of information is passed to a speak function which is responsible for converting the text to speech. We include a default speak function
4
-
which uses the [speechSynthesis API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis), but you can replace this with your own implementation by passing a speak function as the second argument to `Announcer`.
3
+
The `Announcer` library allows for relevant information to be voiced along the focus path of the application. By passing the focus path to `Announcer.onFocusChange` the function traverses the `_focusPath` property collecting strings or promises of strings to announce to the user. The array of information is passed to a SpeechEngine which is responsible for converting the text to speech. By default we use the [speechSynthesis API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis), but you can replace this by overwriting `Announcer._textToSpeech`.
5
4
6
-
Note: The speechSynth api has some known problems:
@@ -38,7 +39,7 @@ Set `announcerEnabled` to true in your app and optionally `debug` to true to see
38
39
| 12 | Grid | No Context ||
39
40
| 13 | BrowsePage-1 | Context | PAUSE-2 Press LEFT or RIGHT to |
40
41
41
-
The `Announcer` will travel through the `_focusPath` looking for `component.announce` then `component.title` properties. After collecting those properties it reverses the `_focusPath` looking for `component.announceContext` properties.
42
+
The `Announcer` will travel through the `_focusPath` looking for `component.announce` then `component.title` properties. After collecting those properties it reverses the `_focusPath` looking for `component.announceContext`.
42
43
43
44
### SpeechType
44
45
@@ -80,36 +81,20 @@ You may also use `PAUSE-#` to pause speech for # seconds before saying the next
80
81
```
81
82
82
83
## API
83
-
84
-
### Options
85
-
86
-
| name | type | readonly | default | description |
| announcerEnabled | boolean | false | flag to turn on or off Announcer |
88
+
|enabled| boolean | false | default true - flag to turn on or off Announcer |
96
89
| announcerTimeout | number | false | By default the announcer only gets information about what changed between focus paths. The announcerTimeout resets the cache to announce the full focus path when the user has been inactive a certain amount of time. Default value is 5 minutes. |
| |`options`| Object containing one or more boolean flags: <br/><ul><li>append - Appends announcement to the currently announcing series.</li><li>notification - Speaks out notification and then performs $announcerRefresh.</li></ul> |
105
-
| $announcerRefresh | depth | Performs an announce using the focusPath - depth can trim known focusPath |
106
-
| $announcerCancel | none | Cancels current speaking |
107
-
108
-
### Events
109
-
110
-
These stage level events can be listened to using the syntax `this.stage.on('EVENT_NAME', callback);`
| announceEnded | - | emitted when all contents of the announce array have finished being read out |
115
-
| announceTimoutEnded | - | emitted after the amount of time of announded word count \* 500ms, used to account for the known speechSynth api issues above |
98
+
| clearPrevFocus |`depth`| Clears the last known focusPath - depth can trim known focusPath |
99
+
| cancel | none | Cancels current speaking |
100
+
| setupTimers |`options`| Object containing: <br/><ul><li>focusDebounce - default amount of time to wait after last input before focus change announcing will occur.</li><li>focusChangeTimeout - Amount of time with no input before full announce will occur on next focusChange</li></ul> |
0 commit comments