Skip to content

Commit 964ab78

Browse files
committed
Fix:announcements by the screen reader interrupt any existing speech
TODO comment:Use announceForAccessibilityWithOptions to queue this behind any in-progress announcements By default announcements will interrupt any existing speech, but they can be queued behind existing speech by setting queue to true in the second parameter of announceForAccessibilityWithOptions method as it takes an object. i have replaced announceForAccessibility() with announceForAccessibilityWithOptions(). fixes: zulip#5611
1 parent 966c36a commit 964ab78

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/boot/OfflineNoticeProvider.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ export function OfflineNoticeProvider(props: ProviderProps): Node {
212212
// another app.)
213213

214214
if (shouldShowUncertaintyNotice && !haveAnnouncedUncertain.current) {
215-
// TODO(react-native-68): Use announceForAccessibilityWithOptions to
216-
// queue this behind any in-progress announcements
217-
AccessibilityInfo.announceForAccessibility(_('Zulip’s Internet connection is uncertain.'));
215+
AccessibilityInfo.announceForAccessibilityWithOptions(
216+
_('Zulip’s Internet connection is uncertain.'),
217+
{ queue: true },
218+
);
218219
haveAnnouncedUncertain.current = true;
219220
}
220221

@@ -226,9 +227,7 @@ export function OfflineNoticeProvider(props: ProviderProps): Node {
226227
isOnline === true
227228
&& (haveAnnouncedOffline.current || haveAnnouncedUncertain.current)
228229
) {
229-
// TODO(react-native-68): Use announceForAccessibilityWithOptions to
230-
// queue this behind any in-progress announcements
231-
AccessibilityInfo.announceForAccessibility(_('Zulip is online.'));
230+
AccessibilityInfo.announceForAccessibilityWithOptions(_('Zulip is online.'), { queue: true });
232231
haveAnnouncedOffline.current = false;
233232
haveAnnouncedUncertain.current = false;
234233
}

0 commit comments

Comments
 (0)