浏览代码

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年前
父节点
当前提交
2b8cc89df0
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 29 次插入3 次删除
  1. 1
    1
      lang/main.json
  2. 28
    2
      react/features/participants-pane/components/web/ParticipantsPaneButton.tsx

+ 1
- 1
lang/main.json 查看文件

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

+ 28
- 2
react/features/participants-pane/components/web/ParticipantsPaneButton.tsx 查看文件

4
 import { IReduxState } from '../../../app/types';
4
 import { IReduxState } from '../../../app/types';
5
 import { translate } from '../../../base/i18n/functions';
5
 import { translate } from '../../../base/i18n/functions';
6
 import { IconUsers } from '../../../base/icons/svg';
6
 import { IconUsers } from '../../../base/icons/svg';
7
+import { getParticipantCount } from '../../../base/participants/functions';
7
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
8
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
8
 import {
9
 import {
9
     close as closeParticipantsPane,
10
     close as closeParticipantsPane,
29
      * Whether participants feature is enabled or not.
30
      * Whether participants feature is enabled or not.
30
      */
31
      */
31
     _isParticipantsPaneEnabled: boolean;
32
     _isParticipantsPaneEnabled: boolean;
33
+
34
+    /**
35
+     * Participants count.
36
+     */
37
+    _participantsCount: number;
32
 }
38
 }
33
 
39
 
34
 /**
40
 /**
35
  * Implementation of a button for accessing participants pane.
41
  * Implementation of a button for accessing participants pane.
36
  */
42
  */
37
 class ParticipantsPaneButton extends AbstractButton<IProps> {
43
 class ParticipantsPaneButton extends AbstractButton<IProps> {
38
-    accessibilityLabel = 'toolbar.accessibilityLabel.participants';
39
     toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeParticipantsPane';
44
     toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeParticipantsPane';
40
     icon = IconUsers;
45
     icon = IconUsers;
41
     label = 'toolbar.participants';
46
     label = 'toolbar.participants';
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
      * Overrides AbstractButton's {@link Component#render()}.
99
      * Overrides AbstractButton's {@link Component#render()}.
75
      *
100
      *
105
 
130
 
106
     return {
131
     return {
107
         _isOpen: isOpen,
132
         _isOpen: isOpen,
108
-        _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state)
133
+        _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state),
134
+        _participantsCount: getParticipantCount(state)
109
     };
135
     };
110
 }
136
 }
111
 
137
 

正在加载...
取消
保存