11import React from 'react' ;
22import PropTypes from 'prop-types' ;
33import { MeetingControlState } from '@webex/component-adapter-interfaces' ;
4-
4+ import { MUTE_AUDIO_CONTROL , MUTE_VIDEO_CONTROL } from '../../adapters/MeetingsJSONAdapter' ;
55import webexComponentClasses from '../helpers' ;
66import { useMeetingControl } from '../hooks' ;
77import Button from '../generic/Button/Button' ;
88import Icon from '../generic/Icon/Icon' ;
99import Dropdown from '../inputs/Dropdown/Dropdown' ;
10+ import { NO_MIC_ARIA_LABEL_TEXT , NO_CAMERA_ARIA_LABEL_TEXT } from '../../constants' ;
1011
1112const controlTypeToButtonType = {
1213 JOIN : 'join' ,
@@ -39,6 +40,12 @@ function renderButton(sc, action, display, style, showText, asItem, autoFocus, t
3940 } = display ;
4041 const isDisabled = display . state === MeetingControlState . DISABLED ;
4142 const isActive = display . state === MeetingControlState . ACTIVE ;
43+ let ariaLabelText = text ;
44+
45+ const NO_MIC_CAMERA_ARIA_LABEL = {
46+ NO_MIC_ARIA_LABEL : 'No microphone' ,
47+ NO_CAMERA_ARIA_LABEL : 'No camera' ,
48+ } ;
4249
4350 let output ;
4451
@@ -57,14 +64,21 @@ function renderButton(sc, action, display, style, showText, asItem, autoFocus, t
5764 </ Button >
5865 ) ;
5966 } else {
67+ if ( display . ID === MUTE_AUDIO_CONTROL && display . state === MeetingControlState . DISABLED
68+ && text === NO_MIC_CAMERA_ARIA_LABEL . NO_MIC_ARIA_LABEL ) {
69+ ariaLabelText = NO_MIC_ARIA_LABEL_TEXT ;
70+ } else if ( display . ID === MUTE_VIDEO_CONTROL && display . state === MeetingControlState . DISABLED
71+ && text === NO_MIC_CAMERA_ARIA_LABEL . NO_CAMERA_ARIA_LABEL ) {
72+ ariaLabelText = NO_CAMERA_ARIA_LABEL_TEXT ;
73+ }
6074 output = (
6175 < Button
6276 className = { sc ( 'control-button' ) }
6377 type = { controlTypeToButtonType [ type ] || 'default' }
6478 size = { 48 }
6579 isDisabled = { isDisabled }
6680 onClick = { action }
67- ariaLabel = { text || tooltip }
81+ ariaLabel = { ariaLabelText || tooltip }
6882 pressed = { isActive && type === 'TOGGLE' }
6983 tooltip = { tooltip }
7084 autoFocus = { autoFocus }
0 commit comments