Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Improve participants alternative text for screen reader users (#15204)

Calinteodor2b8cc89df086
diff --git a/lang/main.json b/lang/main.json
index 1cd5e33fe2..61e6834be2 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -1255,7 +1255,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",
diff --git a/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx b/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
index b2e7ea59c1..ff30f35b79 100644
--- a/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
+++ b/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
@@ -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,
@@ -29,13 +30,17 @@ interface IProps extends AbstractButtonProps {
* Whether participants feature is enabled or not.
*/
_isParticipantsPaneEnabled: boolean;
+
+ /**
+ * Participants count.
+ */
+ _participantsCount: 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';
@@ -70,6 +75,26 @@ class ParticipantsPaneButton extends AbstractButton<IProps> {
}
}
+
+ /**
+ * Override the _getAccessibilityLabel method to incorporate the dynamic participant count.
+ *
+ * @override
+ * @returns {string}
+ */
+ _getAccessibilityLabel() {
+ const { t, _participantsCount, _isOpen } = this.props;
+
+ if (_isOpen) {
+ return t('toolbar.accessibilityLabel.closeParticipantsPane');
+ }
+
+ return t('toolbar.accessibilityLabel.participants', {
+ participantsCount: _participantsCount
+ });
+
+ }
+
/**
* Overrides AbstractButton's {@link Component#render()}.
*
@@ -105,7 +130,8 @@ function mapStateToProps(state: IReduxState) {
return {
_isOpen: isOpen,
- _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state)
+ _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state),
+ _participantsCount: getParticipantCount(state)
};
}