Skip to content

Commit ca27f40

Browse files
committed
fix: announce muted status in channel details profile
1 parent c0a631f commit ca27f40

4 files changed

Lines changed: 22 additions & 8 deletions

File tree

package/src/components/ChannelDetailsScreen/__tests__/ChannelDetailsProfile.test.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ describe('ChannelDetailsProfile', () => {
107107
expect(screen.getByText('Display Name')).toBeTruthy();
108108
});
109109

110-
it('marks the title with accessibilityRole="header"', () => {
110+
it('exposes the title row as a header labelled with the display name', () => {
111111
renderProfile();
112-
const title = screen.getByText('Display Name');
113-
expect(title.props.accessibilityRole).toBe('header');
112+
const header = screen.getByRole('header');
113+
expect(header.props.accessibilityLabel).toBe('Display Name');
114114
});
115115

116116
it('renders an empty title when the display name is missing', () => {
@@ -178,6 +178,12 @@ describe('ChannelDetailsProfile', () => {
178178
expect(screen.getByTestId('channel-details-profile-muted-indicator')).toBeTruthy();
179179
});
180180

181+
it('announces the muted status in the header accessibility label', () => {
182+
useChannelMuteActiveSpy.mockReturnValue(true);
183+
renderProfile();
184+
expect(screen.getByRole('header').props.accessibilityLabel).toBe('Display Name, Muted');
185+
});
186+
181187
it('does not render the muted indicator when useChannelMuteActive returns false', () => {
182188
useChannelMuteActiveSpy.mockReturnValue(false);
183189
renderProfile();

package/src/components/ChannelDetailsScreen/__tests__/members/ChannelMemberItem.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ describe('ChannelMemberItem accessibility', () => {
9494
describe('ChannelMemberItem muted indicator', () => {
9595
it('renders the muted icon when the member is muted', () => {
9696
renderRow({ isMuted: true, member: memberFor() });
97-
expect(screen.getByLabelText('Muted')).toBeTruthy();
97+
expect(screen.getByTestId('channel-member-muted-indicator')).toBeTruthy();
9898
});
9999

100100
it('does not render the muted icon when the member is not muted', () => {
101101
renderRow({ member: memberFor() });
102-
expect(screen.queryByLabelText('Muted')).toBeNull();
102+
expect(screen.queryByTestId('channel-member-muted-indicator')).toBeNull();
103103
});
104104
});
105105

package/src/components/ChannelDetailsScreen/components/ChannelDetailsProfile.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useMemo } from 'react';
22
import { I18nManager, StyleSheet, Text, View } from 'react-native';
33

4+
import { composeAccessibilityLabel } from '../../../a11y/a11yUtils';
45
import { useChannelDetailsContext } from '../../../contexts/channelDetailsContext/channelDetailsContext';
56
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
67
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
@@ -48,9 +49,16 @@ export const ChannelDetailsProfile = () => {
4849
<View style={[styles.container, containerOverride]}>
4950
<ChannelAvatar channel={channel} showBorder={false} size='2xl' />
5051
<View style={[styles.heading, headingOverride]}>
51-
<View style={styles.titleRow}>
52+
<View
53+
accessibilityLabel={composeAccessibilityLabel(
54+
displayName,
55+
muted ? t('Muted') : undefined,
56+
)}
57+
accessibilityRole='header'
58+
accessible
59+
style={styles.titleRow}
60+
>
5261
<Text
53-
accessibilityRole='header'
5462
numberOfLines={2}
5563
style={[styles.title, { color: semantics.textPrimary }, titleOverride]}
5664
>

package/src/components/ChannelDetailsScreen/components/members/ChannelMemberItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ const ChannelMemberItemInner = ({
103103
<View style={styles.trailing}>
104104
{isMuted ? (
105105
<Mute
106-
accessibilityLabel={t('Muted')}
107106
height={16}
108107
pathFill={semantics.textTertiary}
108+
testID='channel-member-muted-indicator'
109109
width={16}
110110
/>
111111
) : null}

0 commit comments

Comments
 (0)