Skip to content

Commit 0cd33c0

Browse files
feat(a11y): directory search result announcement (#6788)
1 parent a7c03bc commit 0cd33c0

File tree

32 files changed

+93
-21
lines changed

32 files changed

+93
-21
lines changed

app/containers/Avatar/Avatar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const Avatar = React.memo(
3434
avatarExternalProviderUrl,
3535
roomAvatarExternalProviderUrl,
3636
cdnPrefix,
37-
accessibilityLabel
37+
accessibilityLabel,
38+
accessible = true
3839
}: IAvatar) => {
3940
if ((!text && !avatar && !emoji && !rid) || !server) {
4041
return null;
@@ -96,15 +97,15 @@ const Avatar = React.memo(
9697

9798
if (onPress) {
9899
image = (
99-
<Touchable accessibilityLabel={avatarAccessibilityLabel} onPress={onPress}>
100+
<Touchable accessible={accessible} accessibilityLabel={avatarAccessibilityLabel} onPress={onPress}>
100101
{image}
101102
</Touchable>
102103
);
103104
}
104105

105106
return (
106107
<View
107-
accessible
108+
accessible={accessible}
108109
accessibilityLabel={!onPress ? avatarAccessibilityLabel : undefined}
109110
style={[avatarStyle, style]}
110111
testID='avatar'>

app/containers/Avatar/AvatarContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const AvatarContainer = ({
2020
getCustomEmoji,
2121
isStatic,
2222
rid,
23-
accessibilityLabel
23+
accessibilityLabel,
24+
accessible
2425
}: IAvatar): React.ReactElement => {
2526
const server = useAppSelector(state => state.server.server);
2627
const serverVersion = useAppSelector(state => state.server.version);
@@ -71,6 +72,7 @@ const AvatarContainer = ({
7172
serverVersion={serverVersion}
7273
cdnPrefix={cdnPrefix}
7374
accessibilityLabel={accessibilityLabel}
75+
accessible={accessible}
7476
/>
7577
);
7678
};

app/containers/Avatar/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ export interface IAvatar {
2626
roomAvatarExternalProviderUrl?: string;
2727
cdnPrefix?: string;
2828
accessibilityLabel?: string;
29+
accessible?: boolean;
2930
}

app/containers/DirectoryItem/__snapshots__/DirectoryItem.test.tsx.snap

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ exports[`Story Snapshots: CustomStyle should match snapshot 1`] = `
1010
>
1111
<View>
1212
<View
13-
accessibilityLabel="Styled Room undefined"
13+
accessibilityLabel="Styled Room "
1414
accessible={true}
15+
importantForAccessibility="yes"
1516
>
1617
<RNGestureHandlerButton
1718
activeOpacity={1}
@@ -91,7 +92,7 @@ exports[`Story Snapshots: CustomStyle should match snapshot 1`] = `
9192
>
9293
<View
9394
accessibilityLabel="S's avatar"
94-
accessible={true}
95+
accessible={false}
9596
style={
9697
[
9798
{
@@ -266,8 +267,9 @@ exports[`Story Snapshots: Default should match snapshot 1`] = `
266267
>
267268
<View>
268269
<View
269-
accessibilityLabel="General undefined"
270+
accessibilityLabel="General "
270271
accessible={true}
272+
importantForAccessibility="yes"
271273
>
272274
<RNGestureHandlerButton
273275
activeOpacity={1}
@@ -345,7 +347,7 @@ exports[`Story Snapshots: Default should match snapshot 1`] = `
345347
>
346348
<View
347349
accessibilityLabel="G's avatar"
348-
accessible={true}
350+
accessible={false}
349351
style={
350352
[
351353
{
@@ -520,8 +522,9 @@ exports[`Story Snapshots: DirectMessage should match snapshot 1`] = `
520522
>
521523
<View>
522524
<View
523-
accessibilityLabel="Alice Johnson undefined"
525+
accessibilityLabel="Alice Johnson "
524526
accessible={true}
527+
importantForAccessibility="yes"
525528
>
526529
<RNGestureHandlerButton
527530
activeOpacity={1}
@@ -599,7 +602,7 @@ exports[`Story Snapshots: DirectMessage should match snapshot 1`] = `
599602
>
600603
<View
601604
accessibilityLabel="A's avatar"
602-
accessible={true}
605+
accessible={false}
603606
style={
604607
[
605608
{
@@ -745,6 +748,7 @@ exports[`Story Snapshots: LongRoomName should match snapshot 1`] = `
745748
<View
746749
accessibilityLabel="This is a very very very very very very very long room name that should be truncated 9999 members"
747750
accessible={true}
751+
importantForAccessibility="yes"
748752
>
749753
<RNGestureHandlerButton
750754
activeOpacity={1}
@@ -822,7 +826,7 @@ exports[`Story Snapshots: LongRoomName should match snapshot 1`] = `
822826
>
823827
<View
824828
accessibilityLabel="L's avatar"
825-
accessible={true}
829+
accessible={false}
826830
style={
827831
[
828832
{
@@ -1016,8 +1020,9 @@ exports[`Story Snapshots: OnlyTitle should match snapshot 1`] = `
10161020
>
10171021
<View>
10181022
<View
1019-
accessibilityLabel="Just a title undefined"
1023+
accessibilityLabel="Just a title "
10201024
accessible={true}
1025+
importantForAccessibility="yes"
10211026
>
10221027
<RNGestureHandlerButton
10231028
activeOpacity={1}
@@ -1181,8 +1186,9 @@ exports[`Story Snapshots: TeamMain should match snapshot 1`] = `
11811186
>
11821187
<View>
11831188
<View
1184-
accessibilityLabel="Engineering Team undefined"
1189+
accessibilityLabel="Engineering Team "
11851190
accessible={true}
1191+
importantForAccessibility="yes"
11861192
>
11871193
<RNGestureHandlerButton
11881194
activeOpacity={1}
@@ -1260,7 +1266,7 @@ exports[`Story Snapshots: TeamMain should match snapshot 1`] = `
12601266
>
12611267
<View
12621268
accessibilityLabel="E's avatar"
1263-
accessible={true}
1269+
accessible={false}
12641270
style={
12651271
[
12661272
{
@@ -1437,6 +1443,7 @@ exports[`Story Snapshots: WithRightLabel should match snapshot 1`] = `
14371443
<View
14381444
accessibilityLabel="General 123 members"
14391445
accessible={true}
1446+
importantForAccessibility="yes"
14401447
>
14411448
<RNGestureHandlerButton
14421449
activeOpacity={1}
@@ -1514,7 +1521,7 @@ exports[`Story Snapshots: WithRightLabel should match snapshot 1`] = `
15141521
>
15151522
<View
15161523
accessibilityLabel="G's avatar"
1517-
accessible={true}
1524+
accessible={false}
15181525
style={
15191526
[
15201527
{
@@ -1708,8 +1715,9 @@ exports[`Story Snapshots: WithoutDescription should match snapshot 1`] = `
17081715
>
17091716
<View>
17101717
<View
1711-
accessibilityLabel="No description room undefined"
1718+
accessibilityLabel="No description room "
17121719
accessible={true}
1720+
importantForAccessibility="yes"
17131721
>
17141722
<RNGestureHandlerButton
17151723
activeOpacity={1}
@@ -1787,7 +1795,7 @@ exports[`Story Snapshots: WithoutDescription should match snapshot 1`] = `
17871795
>
17881796
<View
17891797
accessibilityLabel="N's avatar"
1790-
accessible={true}
1798+
accessible={false}
17911799
style={
17921800
[
17931801
{

app/containers/DirectoryItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ const DirectoryItem = ({
5252
const height = ROW_HEIGHT * fontScale;
5353

5454
return (
55-
<View accessible accessibilityLabel={`${title} ${rightLabel}`}>
55+
<View accessible accessibilityLabel={`${title || ''} ${rightLabel || ''}`} importantForAccessibility='yes'>
5656
<Touch onPress={onPress} style={{ backgroundColor: colors.surfaceRoom }} testID={testID}>
5757
<View style={[styles.directoryItemContainer, { height }, style]}>
58-
<Avatar text={avatar} size={30} type={type} rid={rid} style={styles.directoryItemAvatar} />
58+
<Avatar accessible={false} text={avatar} size={30} type={type} rid={rid} style={styles.directoryItemAvatar} />
5959
<View style={styles.directoryItemTextContainer}>
6060
<View style={styles.directoryItemTextTitle}>
6161
{type !== 'd' ? <RoomTypeIcon type={type} teamMain={teamMain} /> : null}

app/definitions/rest/v1/directory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export type DirectoryEndpoint = {
88
count: number;
99
offset: number;
1010
sort: { [key: string]: number };
11-
}) => PaginatedResult<{ result: IServerRoom[] }>;
11+
}) => PaginatedResult<{ result: IServerRoom[]; count: number }>;
1212
};
1313
};

app/i18n/locales/ar.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@
381381
"Onboarding_less_options": "خيارات أقل",
382382
"Onboarding_more_options": "خيارات أكثر",
383383
"Onboarding_subtitle": "ما بعد بيئة فريق تعاونية",
384+
"One_result_found": "نتيجة واحدة وُجدت.",
384385
"Online": "متصل",
385386
"Only_authorized_users_can_write_new_messages": "يمكن للمستخدمين المصرح لهم فقط كتابة رسائل جديدة",
386387
"Oops": "عفوًا!",
@@ -492,6 +493,7 @@
492493
"Search_global_users_description": "إذا قمت بالتفعيل، فسيمكنك البحث عن أي مستخدم في شركات أو خوادم أخرى",
493494
"Search_Messages": "بحث الرسائل",
494495
"Search_messages": "رسائل البحث",
496+
"Search_Results_found": "{{count}} تم العثور على نتائج.",
495497
"Security_and_privacy": "الأمن والخصوصية",
496498
"Select_a_Channel": "حدد قناة",
497499
"Select_a_Department": "حدد قسم",

app/i18n/locales/bn-IN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@
549549
"Onboarding_less_options": "কম বিকল্প",
550550
"Onboarding_more_options": "আরও বিকল্প",
551551
"Onboarding_subtitle": "দল সহযোগিতা বাদ দিন",
552+
"One_result_found": "একটি ফলাফল পাওয়া গেছে।",
552553
"Online": "অনলাইন",
553554
"Only_authorized_users_can_write_new_messages": "কেবল অনুমোদিত ব্যবহারকারীরা নতুন বার্তা লিখতে পারবেন",
554555
"Oops": "ওহ!",
@@ -692,6 +693,7 @@
692693
"Search_global_users_description": "আপনি এটি চালু করলে, আপনি অন্যান্য কোম্পানি বা ওয়ার্কস্পেস থেকে যেকোনো ব্যবহারকারীকে সন্ধান করতে পারবেন।",
693694
"Search_Messages": "মেসেজ খুঁজুন",
694695
"Search_messages": "বার্তা অনুসন্ধান করুন",
696+
"Search_Results_found": "{{count}} ফলাফল পাওয়া গেছে।",
695697
"Searching": "অনুসন্ধান করা হচ্ছে",
696698
"Security_and_privacy": "নিরাপত্তা এবং গোপনীয়তা",
697699
"Select": "নির্বাচন করুন",

app/i18n/locales/cs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@
588588
"Onboarding_less_options": "Méně možností",
589589
"Onboarding_more_options": "Více možností",
590590
"Onboarding_subtitle": "Mimo týmovou spolupráci",
591+
"One_result_found": "Jeden výsledek nalezen.",
591592
"Online": "Online",
592593
"Only_authorized_users_can_write_new_messages": "Pouze oprávnění uživatelé mohou psát nové zprávy",
593594
"Oops": "Jejda!",
@@ -741,6 +742,7 @@
741742
"Search_global_users_description": "Pokud zapnete, můžete vyhledat libovolného uživatele z jiných společností nebo pracovních prostorů.",
742743
"Search_Messages": "Hledat zprávy",
743744
"Search_messages": "Hledat zprávy",
745+
"Search_Results_found": "{{count}} výsledků nalezeno.",
744746
"Searching": "Hledání",
745747
"Security_and_privacy": "Bezpečnost a soukromí",
746748
"Select": "Vybrat",

app/i18n/locales/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@
538538
"Onboarding_less_options": "Weniger Optionen",
539539
"Onboarding_more_options": "Mehr Optionen",
540540
"Onboarding_subtitle": "Mehr als Team-Zusammenarbeit",
541+
"One_result_found": "Ein Ergebnis gefunden.",
541542
"Online": "Online",
542543
"Only_authorized_users_can_write_new_messages": "Nur autorisierte Benutzer können neue Nachrichten schreiben",
543544
"Oops": "Hoppla!",
@@ -679,6 +680,7 @@
679680
"Search_global_users_description": "Wenn aktiviert, Können Sie nach Benutzern von anderen Unternehmen oder Servern suchen.",
680681
"Search_Messages": "Nachrichten suchen",
681682
"Search_messages": "Nachrichten durchsuchen",
683+
"Search_Results_found": "{{count}} Ergebnisse gefunden.",
682684
"Searching": "Suche",
683685
"Security_and_privacy": "Sicherheit und Datenschutz",
684686
"Select_a_Channel": "Channel auswählen",

0 commit comments

Comments
 (0)