Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(native): add accessibility labels to SpeakerStatsItem and TimeElapsed

Muskan Kumari8fffb14b7be1
diff --git a/react/features/speaker-stats/components/native/SpeakerStatsItem.tsx b/react/features/speaker-stats/components/native/SpeakerStatsItem.tsx
index 9b73ba491e..527e93e339 100644
--- a/react/features/speaker-stats/components/native/SpeakerStatsItem.tsx
+++ b/react/features/speaker-stats/components/native/SpeakerStatsItem.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { Text, View, ViewStyle } from 'react-native';
import Avatar from '../../../base/avatar/components/Avatar';
@@ -37,40 +38,50 @@ interface IProps {
participantId: string;
}
-const SpeakerStatsItem = (props: IProps) =>
- (
+const SpeakerStatsItem = (props: IProps) => {
+ const { t } = useTranslation();
+ const { displayName, dominantSpeakerTime, hasLeft, isDominantSpeaker, participantId } = props;
+ const speakerLabel = t('speakerStats.speakerStats');
+ const speakerTimeLabel = t('speakerStats.speakerTime');
+ const nameLabel = `${speakerLabel}: ${displayName}`;
+
+ return (
<View
- key = { props.participantId }
+ key = { participantId }
style = { style.speakerStatsItemContainer as ViewStyle }>
<View style = { style.speakerStatsAvatar }>
{
- props.hasLeft ? (
+ hasLeft ? (
<StatelessAvatar
color = { BaseTheme.palette.ui05 }
- initials = { getInitials(props.displayName) }
+ initials = { getInitials(displayName) }
size = { BaseTheme.spacing[5] } />
) : (
<Avatar
className = 'userAvatar'
- participantId = { props.participantId }
+ participantId = { participantId }
size = { BaseTheme.spacing[5] } />
)
}
</View>
<View style = { style.speakerStatsNameTime as ViewStyle } >
- <Text style = { [ style.speakerStatsText, props.hasLeft && style.speakerStatsLeft ] }>
- {props.displayName}
+ <Text
+ accessibilityLabel = { nameLabel }
+ style = { [ style.speakerStatsText, hasLeft && style.speakerStatsLeft ] }>
+ {displayName}
</Text>
<TimeElapsed
+ accessibilityLabel = { speakerTimeLabel }
style = { [
style.speakerStatsText,
style.speakerStatsTime,
- props.isDominantSpeaker && style.speakerStatsDominant,
- props.hasLeft && style.speakerStatsLeft
+ isDominantSpeaker && style.speakerStatsDominant,
+ hasLeft && style.speakerStatsLeft
] }
- time = { props.dominantSpeakerTime } />
+ time = { dominantSpeakerTime } />
</View>
</View>
);
+};
export default SpeakerStatsItem;
diff --git a/react/features/speaker-stats/components/native/TimeElapsed.tsx b/react/features/speaker-stats/components/native/TimeElapsed.tsx
index 87b4e48a74..4998dff080 100644
--- a/react/features/speaker-stats/components/native/TimeElapsed.tsx
+++ b/react/features/speaker-stats/components/native/TimeElapsed.tsx
@@ -10,6 +10,11 @@ import { createLocalizedTime } from '../timeFunctions';
*/
interface IProps extends WithTranslation {
+ /**
+ * Accessibility label prefix.
+ */
+ accessibilityLabel: string;
+
/**
* Style for text.
*/
@@ -36,11 +41,15 @@ class TimeElapsed extends PureComponent<IProps> {
* @returns {ReactElement}
*/
override render() {
- const { style, time, t } = this.props;
+ const { accessibilityLabel, style, time, t } = this.props;
const timeElapsed = createLocalizedTime(time, t);
+ const timeStr = timeElapsed.join(' ');
+ const label = `${accessibilityLabel}: ${timeStr}`;
return (
- <Text style = { style }>
+ <Text
+ accessibilityLabel = { label }
+ style = { style }>
{ timeElapsed }
</Text>
);