Skip to content

Commit

Permalink
Add queue option for accessibility announcements in OfflineNoticeProv…
Browse files Browse the repository at this point in the history
…ider
  • Loading branch information
Dashwave authored and burnerlee committed Nov 20, 2024
1 parent 15b5130 commit 6a41695
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/boot/OfflineNoticeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ const OfflineNoticeContext = React.createContext({
noticeContentAreaHeight: 0,
});

type ProviderProps = {|
+children: Node,
|};
type ProviderProps = {| +children: Node,|};

Check failure on line 127 in src/boot/OfflineNoticeProvider.js

View workflow job for this annotation

GitHub Actions / test

A space is required after ','

Check failure on line 127 in src/boot/OfflineNoticeProvider.js

View workflow job for this annotation

GitHub Actions / test

A space is required after ','

const backgroundColorForTheme = (theme: ThemeName): string =>
// TODO(redesign): Choose these more intentionally; these are just the
Expand Down Expand Up @@ -212,9 +210,10 @@ export function OfflineNoticeProvider(props: ProviderProps): Node {
// another app.)

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;
}

Expand All @@ -226,9 +225,7 @@ export function OfflineNoticeProvider(props: ProviderProps): Node {
isOnline === true
&& (haveAnnouncedOffline.current || haveAnnouncedUncertain.current)
) {
// 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 6a41695

Please sign in to comment.