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 chat send and reaction gif buttons (#18091)

Muskan Kumari70e010b5e675
diff --git a/react/features/chat/components/native/ChatInputBar.tsx b/react/features/chat/components/native/ChatInputBar.tsx
index 6fad8bcd25..1f947fe855 100644
--- a/react/features/chat/components/native/ChatInputBar.tsx
+++ b/react/features/chat/components/native/ChatInputBar.tsx
@@ -132,18 +132,23 @@ class ChatInputBar extends Component<IProps, IState> {
* @inheritdoc
*/
override render() {
+ const { t } = this.props;
+
if (_isSendDisabled(this.props)) {
return (
<View
id = 'no-messages-message'
style = { styles.disabledSendWrapper as ViewStyle }>
<Text style = { styles.emptyComponentText as TextStyle }>
- { this.props.t('chat.disabled') }
+ { t('chat.disabled') }
</Text>
</View>
);
}
+ const messageInputLabel = t('chat.fieldPlaceHolder');
+ const sendButtonLabel = t('chat.sendButton');
+
return (
<View
id = 'chat-input'
@@ -152,18 +157,20 @@ class ChatInputBar extends Component<IProps, IState> {
this.state.addPadding ? styles.extraBarPadding : null
] as ViewStyle[] }>
<Input
+ accessibilityLabel = { messageInputLabel }
blurOnSubmit = { false }
customStyles = {{ container: styles.customInputContainer }}
id = 'chat-input-messagebox'
multiline = { false }
onChange = { this._onChangeText }
onSubmitEditing = { this._onSubmit }
- placeholder = { this.props.t('chat.fieldPlaceHolder') }
+ placeholder = { messageInputLabel }
returnKeyType = 'send'
value = { this.state.message } />
<IconButton
+ accessibilityLabel = { sendButtonLabel }
disabled = { !this.state.message }
- id = { this.props.t('chat.sendButton') }
+ id = { sendButtonLabel }
onPress = { this._onSubmit }
src = { IconSend }
style = { styles.sendButton }
diff --git a/react/features/reactions/components/native/ReactionButton.tsx b/react/features/reactions/components/native/ReactionButton.tsx
index 5623868ac9..db2a6a09ba 100644
--- a/react/features/reactions/components/native/ReactionButton.tsx
+++ b/react/features/reactions/components/native/ReactionButton.tsx
@@ -49,6 +49,11 @@ interface IReactionStyles {
*/
interface IProps extends WithTranslation {
+ /**
+ * Optional accessibility label for the button.
+ */
+ accessibilityLabel?: string;
+
/**
* Component children.
*/
@@ -76,6 +81,7 @@ interface IProps extends WithTranslation {
* @returns {ReactElement}
*/
function ReactionButton({
+ accessibilityLabel,
children,
onClick,
styles,
@@ -90,9 +96,11 @@ function ReactionButton({
}
}, [ reaction ]);
+ const label = accessibilityLabel ?? (reaction ? t(`toolbar.accessibilityLabel.${reaction}`) : undefined);
+
return (
<TouchableHighlight
- accessibilityLabel = { t(`toolbar.accessibilityLabel.${reaction}`) }
+ accessibilityLabel = { label }
accessibilityRole = 'button'
onPress = { onClick || _onClick }
style = { [ styles.style, children && styles?.gifButton ] as ViewStyle[] }
diff --git a/react/features/reactions/components/native/ReactionMenu.tsx b/react/features/reactions/components/native/ReactionMenu.tsx
index b8b3cc5d1a..bc8a0a91aa 100644
--- a/react/features/reactions/components/native/ReactionMenu.tsx
+++ b/react/features/reactions/components/native/ReactionMenu.tsx
@@ -1,4 +1,5 @@
import React, { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
import { Image, View } from 'react-native';
import { useSelector } from 'react-redux';
@@ -37,8 +38,10 @@ function ReactionMenu({
onCancel,
overflowMenu
}: IProps) {
+ const { t } = useTranslation();
const _styles: any = useSelector((state: IReduxState) => ColorSchemeRegistry.get(state, 'Toolbox'));
const gifEnabled = useSelector(isGifEnabled);
+ const gifLabel = t('toolbar.accessibilityLabel.giphy');
const openGifMenu = useCallback(() => {
navigate(screen.conference.gifsMenu);
@@ -59,6 +62,7 @@ function ReactionMenu({
{
gifEnabled && (
<ReactionButton
+ accessibilityLabel = { gifLabel }
onClick = { openGifMenu }
styles = { _styles.reactionButton }>
<Image // @ts-ignore