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(carmode): add accessibility label and state to microphone button (#18095)

Muskan Kumari3860ada65d27
diff --git a/react/features/conference/components/native/carmode/MicrophoneButton.tsx b/react/features/conference/components/native/carmode/MicrophoneButton.tsx
index 8f38216964..596f3ccdfa 100644
--- a/react/features/conference/components/native/carmode/MicrophoneButton.tsx
+++ b/react/features/conference/components/native/carmode/MicrophoneButton.tsx
@@ -1,4 +1,5 @@
import React, { useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { TouchableOpacity, View, ViewStyle } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
@@ -28,6 +29,7 @@ const LONG_PRESS = 'long.press';
* @returns {JSX.Element} - The audio mute round button.
*/
const MicrophoneButton = (): JSX.Element | null => {
+ const { t } = useTranslation();
const dispatch = useDispatch();
const audioMuted = useSelector((state: IReduxState) => isLocalTrackMuted(state['features/base/tracks'],
MEDIA_TYPE.AUDIO));
@@ -35,6 +37,13 @@ const MicrophoneButton = (): JSX.Element | null => {
const enabledFlag = useSelector((state: IReduxState) => getFeatureFlag(state, AUDIO_MUTE_BUTTON_ENABLED, true));
const [ longPress, setLongPress ] = useState(false);
+ const accessibilityLabelKey = audioMuted ? 'toolbar.accessibilityLabel.unmute' : 'toolbar.accessibilityLabel.mute';
+ const accessibilityLabel = t(accessibilityLabelKey);
+ const accessibilityState = {
+ disabled,
+ selected: !audioMuted
+ };
+
const onPressIn = useCallback(() => {
!disabled && dispatch(muteLocal(!audioMuted, MEDIA_TYPE.AUDIO));
}, [ audioMuted, disabled ]);
@@ -69,6 +78,10 @@ const MicrophoneButton = (): JSX.Element | null => {
return (
<TouchableOpacity
+ accessibilityLabel = { accessibilityLabel }
+ accessibilityRole = 'button'
+ accessibilityState = { accessibilityState }
+ disabled = { disabled }
onLongPress = { onLongPress }
onPressIn = { onPressIn }
onPressOut = { onPressOut } >