Bladeren bron

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

* add the participants count to the aria label and fix the accessibility toggle for the participants button

---------

Co-authored-by: AHMAD KADRI <52747422+ahmadkadri@users.noreply.github.com>
factor2
Calinteodor 1 jaar geleden
bovenliggende
commit
2b8cc89df0
No account linked to committer's email address
2 gewijzigde bestanden met toevoegingen van 29 en 3 verwijderingen
  1. 1
    1
      lang/main.json
  2. 28
    2
      react/features/participants-pane/components/web/ParticipantsPaneButton.tsx

+ 1
- 1
lang/main.json Bestand weergeven

@@ -1255,7 +1255,7 @@
1255 1255
             "muteGUMPending": "Connecting your microphone",
1256 1256
             "noiseSuppression": "Noise suppression",
1257 1257
             "openChat": "Open chat",
1258
-            "participants": "Open participants pane",
1258
+            "participants": "Open participants pane. {{participantsCount}} participants",
1259 1259
             "pip": "Toggle Picture-in-Picture mode",
1260 1260
             "privateMessage": "Send private message",
1261 1261
             "profile": "Edit your profile",

+ 28
- 2
react/features/participants-pane/components/web/ParticipantsPaneButton.tsx Bestand weergeven

@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
4 4
 import { IReduxState } from '../../../app/types';
5 5
 import { translate } from '../../../base/i18n/functions';
6 6
 import { IconUsers } from '../../../base/icons/svg';
7
+import { getParticipantCount } from '../../../base/participants/functions';
7 8
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
8 9
 import {
9 10
     close as closeParticipantsPane,
@@ -29,13 +30,17 @@ interface IProps extends AbstractButtonProps {
29 30
      * Whether participants feature is enabled or not.
30 31
      */
31 32
     _isParticipantsPaneEnabled: boolean;
33
+
34
+    /**
35
+     * Participants count.
36
+     */
37
+    _participantsCount: number;
32 38
 }
33 39
 
34 40
 /**
35 41
  * Implementation of a button for accessing participants pane.
36 42
  */
37 43
 class ParticipantsPaneButton extends AbstractButton<IProps> {
38
-    accessibilityLabel = 'toolbar.accessibilityLabel.participants';
39 44
     toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeParticipantsPane';
40 45
     icon = IconUsers;
41 46
     label = 'toolbar.participants';
@@ -70,6 +75,26 @@ class ParticipantsPaneButton extends AbstractButton<IProps> {
70 75
         }
71 76
     }
72 77
 
78
+
79
+    /**
80
+     * Override the _getAccessibilityLabel method to incorporate the dynamic participant count.
81
+     *
82
+     * @override
83
+     * @returns {string}
84
+     */
85
+    _getAccessibilityLabel() {
86
+        const { t, _participantsCount, _isOpen } = this.props;
87
+
88
+        if (_isOpen) {
89
+            return t('toolbar.accessibilityLabel.closeParticipantsPane');
90
+        }
91
+
92
+        return t('toolbar.accessibilityLabel.participants', {
93
+            participantsCount: _participantsCount
94
+        });
95
+
96
+    }
97
+
73 98
     /**
74 99
      * Overrides AbstractButton's {@link Component#render()}.
75 100
      *
@@ -105,7 +130,8 @@ function mapStateToProps(state: IReduxState) {
105 130
 
106 131
     return {
107 132
         _isOpen: isOpen,
108
-        _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state)
133
+        _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state),
134
+        _participantsCount: getParticipantCount(state)
109 135
     };
110 136
 }
111 137
 

Laden…
Annuleren
Opslaan