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 language selector items

Muskan Kumari6f138d435ce4
diff --git a/react/features/settings/components/native/LanguageSelectView.tsx b/react/features/settings/components/native/LanguageSelectView.tsx
index 8d08a6dd45..a71c142681 100644
--- a/react/features/settings/components/native/LanguageSelectView.tsx
+++ b/react/features/settings/components/native/LanguageSelectView.tsx
@@ -57,28 +57,35 @@ const LanguageSelectView = ({ goBack, isInWelcomePage }: {
bounces = { isInWelcomePage }
contentContainerStyle = { styles.profileView as ViewStyle }>
{
- LANGUAGES.map(language => (
- <TouchableHighlight
- accessibilityRole = 'button'
- accessibilityState = {{
- disabled: currentLanguage === language,
- selected: currentLanguage === language
- }}
- disabled = { currentLanguage === language }
- key = { language }
- onPress = { setLanguage(language) }>
- <View
- style = { styles.languageOption as ViewStyle }>
- <Text
- style = { [
- styles.text,
- styles.fieldLabelText,
- currentLanguage === language && styles.selectedLanguage ] }>
- { t(`languages:${language}`) }
- </Text>
- </View>
- </TouchableHighlight>
- ))
+ LANGUAGES.map(language => {
+ const isSelected = currentLanguage === language;
+ const label = t(`languages:${language}`);
+ const accessibilityState = {
+ disabled: isSelected,
+ selected: isSelected
+ };
+
+ return (
+ <TouchableHighlight
+ accessibilityLabel = { label }
+ accessibilityRole = 'button'
+ accessibilityState = { accessibilityState }
+ disabled = { isSelected }
+ key = { language }
+ onPress = { setLanguage(language) }>
+ <View
+ style = { styles.languageOption as ViewStyle }>
+ <Text
+ style = { [
+ styles.text,
+ styles.fieldLabelText,
+ isSelected && styles.selectedLanguage ] }>
+ { label }
+ </Text>
+ </View>
+ </TouchableHighlight>
+ );
+ })
}
</ScrollView>
</JitsiScreen>
diff --git a/react/features/subtitles/components/native/LanguageListItem.tsx b/react/features/subtitles/components/native/LanguageListItem.tsx
index c305526721..3a6680671f 100644
--- a/react/features/subtitles/components/native/LanguageListItem.tsx
+++ b/react/features/subtitles/components/native/LanguageListItem.tsx
@@ -40,6 +40,9 @@ const LanguageListItem = ({ t, lang, selected, onLanguageSelected
const onLanguageSelectedWrapper
= useCallback(() => onLanguageSelected(lang), [ lang ]);
+ const label = t(lang);
+ const accessibilityState = { selected };
+
return (
<View style = { styles.languageItemWrapper as StyleProp<ViewStyle> }>
<View style = { styles.iconWrapper }>
@@ -51,15 +54,16 @@ const LanguageListItem = ({ t, lang, selected, onLanguageSelected
}
</View>
<TouchableHighlight
+ accessibilityLabel = { label }
accessibilityRole = 'button'
- accessibilityState = {{ selected }}
+ accessibilityState = { accessibilityState }
onPress = { onLanguageSelectedWrapper }
underlayColor = { 'transparent' } >
<Text
style = { [
styles.languageItemText,
selected && styles.activeLanguageItemText ] }>
- { t(lang) }
+ { label }
</Text>
</TouchableHighlight>
</View>