Skip to content

Commit

Permalink
Fix:announcements by the screen reader interrupt any existing speech.
Browse files Browse the repository at this point in the history
  • Loading branch information
1010nishant committed Jan 21, 2023
1 parent 966c36a commit 7efaba6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/boot/OfflineNoticeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ export function OfflineNoticeProvider(props: ProviderProps): Node {
if (shouldShowUncertaintyNotice && !haveAnnouncedUncertain.current) {
// TODO(react-native-68): Use announceForAccessibilityWithOptions to
// queue this behind any in-progress announcements
AccessibilityInfo.announceForAccessibility(_('Zulip’s Internet connection is uncertain.'));
AccessibilityInfo.announceForAccessibilityWithOptions(_('Zulip’s Internet connection is uncertain.'), { queue: true });
haveAnnouncedUncertain.current = true;
}

if (isOnline === false && (!haveAnnouncedOffline.current || haveAnnouncedUncertain.current)) {
AccessibilityInfo.announceForAccessibility(_('Zulip is offline.'));
AccessibilityInfo.announceForAccessibilityWithOptions(_('Zulip is offline.'), { queue: false });
haveAnnouncedOffline.current = true;
haveAnnouncedUncertain.current = false;
} else if (
Expand All @@ -228,7 +228,8 @@ export function OfflineNoticeProvider(props: ProviderProps): Node {
) {
// TODO(react-native-68): Use announceForAccessibilityWithOptions to
// queue this behind any in-progress announcements
AccessibilityInfo.announceForAccessibility(_('Zulip is online.'));
AccessibilityInfo.announceForAccessibilityWithOptions(_('Zulip is online.'), { queue: true });

haveAnnouncedOffline.current = false;
haveAnnouncedUncertain.current = false;
}
Expand Down

0 comments on commit 7efaba6

Please sign in to comment.