Skip to content

Commit 98c51a6

Browse files
fix(mobile): announce plugin notification banners to screen readers
The banner disappears after a few seconds, so a screen reader user heard it only if focus happened to land on it. It is now a live region for TalkBack and announced on iOS when it appears. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent bf81ff1 commit 98c51a6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎apps/mobile/src/features/plugins/PluginNotificationBannerHost.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "@t3tools/client-runtime/state/plugin-notifications";
99
import type { ContributionStatusTone, EnvironmentId } from "@t3tools/contracts";
1010
import { useCallback, useEffect, useRef, useState } from "react";
11-
import { Pressable, View } from "react-native";
11+
import { AccessibilityInfo, Platform, Pressable, View } from "react-native";
1212
import { useSafeAreaInsets } from "react-native-safe-area-context";
1313

1414
import { AppText as Text } from "../../components/AppText";
@@ -117,9 +117,16 @@ function PluginNotificationBanner(props: {
117117
const linkTo = useLinkTo();
118118
const { threadId, title, tone } = banner.entry.notification;
119119
const description = pluginNotificationDescription(banner.entry);
120+
// The banner leaves on its own, so it is announced rather than waiting for
121+
// focus: accessibilityLiveRegion reaches TalkBack, VoiceOver needs this.
122+
useEffect(() => {
123+
if (Platform.OS === "ios")
124+
AccessibilityInfo.announceForAccessibility(`${title}. ${description}`);
125+
}, [title, description]);
120126

121127
return (
122128
<View
129+
accessibilityLiveRegion="polite"
123130
pointerEvents="box-none"
124131
className="absolute inset-x-0 items-center px-3"
125132
style={{ top: insets.top + 4 }}

0 commit comments

Comments
 (0)