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 roles, labels and states to settings and language selectors (#18048)

Muskan Kumarib656ba9303e5
diff --git a/react/features/chat/components/native/ClosedCaptions.tsx b/react/features/chat/components/native/ClosedCaptions.tsx
index 855c1beeb1..b6ac275076 100644
--- a/react/features/chat/components/native/ClosedCaptions.tsx
+++ b/react/features/chat/components/native/ClosedCaptions.tsx
@@ -89,11 +89,17 @@ const ClosedCaptions = ({
);
}
+ const languageButtonAccessibilityLabel
+ = `${t('transcribing.translateTo')} ${t(selectedLanguage ?? 'transcribing.subtitlesOff')}`;
+
return (
<>
<View style = { closedCaptionsStyles.languageButtonContainer as ViewStyle }>
<Text style = { closedCaptionsStyles.languageButtonText }>{ t('transcribing.translateTo') }:</Text>
- <TouchableHighlight onPress = { navigateToLanguageSelect }>
+ <TouchableHighlight
+ accessibilityLabel = { languageButtonAccessibilityLabel }
+ accessibilityRole = 'button'
+ onPress = { navigateToLanguageSelect }>
<View style = { closedCaptionsStyles.languageButtonContent as ViewStyle }>
<Text style = { closedCaptionsStyles.languageButtonText }>{ t(selectedLanguage ?? 'transcribing.subtitlesOff') }</Text>
<Icon
diff --git a/react/features/settings/components/native/GeneralSection.tsx b/react/features/settings/components/native/GeneralSection.tsx
index f30a5ce806..77c45d56a0 100644
--- a/react/features/settings/components/native/GeneralSection.tsx
+++ b/react/features/settings/components/native/GeneralSection.tsx
@@ -34,6 +34,8 @@ const GeneralSection = () => {
navigate(screen.settings.language);
}, [ navigate, screen ]);
+ const languageAccessibilityLabel = `${t('settings.language')}, ${t(`languages:${language}`)}`;
+
return (
<FormSection>
<FormRow label = 'videothumbnail.hideSelfView'>
@@ -43,7 +45,10 @@ const GeneralSection = () => {
</FormRow>
<FormRow label = 'settings.language'>
<View style = { styles.languageButtonContainer as ViewStyle }>
- <TouchableHighlight onPress = { navigateToLanguageSelect }>
+ <TouchableHighlight
+ accessibilityLabel = { languageAccessibilityLabel }
+ accessibilityRole = 'button'
+ onPress = { navigateToLanguageSelect }>
<View style = { styles.languageButton as ViewStyle }>
<Text
style = { styles.languageText }>{t(`languages:${language}`)}</Text>
diff --git a/react/features/settings/components/native/LanguageSelectView.tsx b/react/features/settings/components/native/LanguageSelectView.tsx
index e21212a47d..8d08a6dd45 100644
--- a/react/features/settings/components/native/LanguageSelectView.tsx
+++ b/react/features/settings/components/native/LanguageSelectView.tsx
@@ -59,6 +59,11 @@ const LanguageSelectView = ({ goBack, isInWelcomePage }: {
{
LANGUAGES.map(language => (
<TouchableHighlight
+ accessibilityRole = 'button'
+ accessibilityState = {{
+ disabled: currentLanguage === language,
+ selected: currentLanguage === language
+ }}
disabled = { currentLanguage === language }
key = { language }
onPress = { setLanguage(language) }>
diff --git a/react/features/settings/components/native/SettingsView.tsx b/react/features/settings/components/native/SettingsView.tsx
index ed24b7f93a..48428e1cf2 100644
--- a/react/features/settings/components/native/SettingsView.tsx
+++ b/react/features/settings/components/native/SettingsView.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useTranslation } from 'react-i18next';
import {
ScrollView,
Text,
@@ -37,6 +38,7 @@ interface IProps {
}
const SettingsView = ({ isInWelcomePage }: IProps) => {
+ const { t } = useTranslation();
const { displayName } = useSelector((state: IReduxState) => state['features/base/settings']);
const localParticipant = useSelector((state: IReduxState) => getLocalParticipant(state));
const showModeratorSettings = useSelector((state: IReduxState) => shouldShowModeratorSettings(state));
@@ -46,6 +48,10 @@ const SettingsView = ({ isInWelcomePage }: IProps) => {
const localParticipantId = localParticipant?.id;
const scrollBounces = Boolean(isInWelcomePage);
+ const profileAccessibilityLabel = displayName
+ ? `${displayName}, ${t('toolbar.profile')}`
+ : t('toolbar.profile');
+
if (visible !== undefined && !visible) {
return null;
}
@@ -60,6 +66,8 @@ const SettingsView = ({ isInWelcomePage }: IProps) => {
<TouchableHighlight
/* eslint-disable react/jsx-no-bind */
+ accessibilityLabel = { profileAccessibilityLabel }
+ accessibilityRole = 'button'
onPress = { () => navigate(screen.settings.profile) }>
<View
style = { styles.profileContainer as ViewStyle }>
diff --git a/react/features/subtitles/components/native/LanguageListItem.tsx b/react/features/subtitles/components/native/LanguageListItem.tsx
index 781914c94f..c305526721 100644
--- a/react/features/subtitles/components/native/LanguageListItem.tsx
+++ b/react/features/subtitles/components/native/LanguageListItem.tsx
@@ -51,6 +51,8 @@ const LanguageListItem = ({ t, lang, selected, onLanguageSelected
}
</View>
<TouchableHighlight
+ accessibilityRole = 'button'
+ accessibilityState = {{ selected }}
onPress = { onLanguageSelectedWrapper }
underlayColor = { 'transparent' } >
<Text