Skip to content

Commit

Permalink
add the particpants count to the aria label
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadkadri committed Aug 12, 2024
1 parent 668d874 commit 5fadcaa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@
"muteGUMPending": "Connecting your microphone",
"noiseSuppression": "Noise suppression",
"openChat": "Open chat",
"participants": "Open participants pane",
"participants": "Open participants pane. {{participantsCount}} participants",
"pip": "Toggle Picture-in-Picture mode",
"privateMessage": "Send private message",
"profile": "Edit your profile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IconUsers } from '../../../base/icons/svg';
import { getParticipantCount } from '../../../base/participants/functions';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import {
close as closeParticipantsPane,
Expand All @@ -29,13 +30,17 @@ interface IProps extends AbstractButtonProps {
* Whether participants feature is enabled or not.
*/
_isParticipantsPaneEnabled: boolean;

/**
* Participants count.
*/
_particioantsCount: number;
}

/**
* Implementation of a button for accessing participants pane.
*/
class ParticipantsPaneButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.participants';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeParticipantsPane';
icon = IconUsers;
label = 'toolbar.participants';
Expand Down Expand Up @@ -70,6 +75,21 @@ class ParticipantsPaneButton extends AbstractButton<IProps> {
}
}


/**
* Override the _getAccessibilityLabel method to incorporate the dynamic participant count.
*
* @override
* @returns {string}
*/
_getAccessibilityLabel() {
const { t, _particioantsCount } = this.props;

return t('toolbar.accessibilityLabel.participants', {
participantsCount: _particioantsCount
});
}

/**
* Overrides AbstractButton's {@link Component#render()}.
*
Expand Down Expand Up @@ -105,7 +125,8 @@ function mapStateToProps(state: IReduxState) {

return {
_isOpen: isOpen,
_isParticipantsPaneEnabled: isParticipantsPaneEnabled(state)
_isParticipantsPaneEnabled: isParticipantsPaneEnabled(state),
_particioantsCount: getParticipantCount(state)
};
}

Expand Down

0 comments on commit 5fadcaa

Please sign in to comment.