Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1a0e5c1

Browse files
authored
Fix multiple accessibility defects identified by AXE (#10606)
* Mark effects overlay canvas as aria hidden * Ensure date separators aren't seen as focusable aria separators * Fix * Fix font slider not having aria label * Add missing aria labels * Fix settings flags setting aria-checked={null} * Update snapshots
1 parent 270a26d commit 1a0e5c1

File tree

17 files changed

+207
-191
lines changed

17 files changed

+207
-191
lines changed

res/css/components/views/settings/devices/_SelectableDeviceTile.pcss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ limitations under the License.
2222
}
2323

2424
.mx_SelectableDeviceTile_checkbox {
25-
flex: 0 0;
26-
margin-right: $spacing-16;
25+
flex: 1 0;
26+
27+
.mx_Checkbox_background + div {
28+
flex: 1 0;
29+
/* override more specific selector */
30+
margin-left: $spacing-16 !important;
31+
}
2732
}

src/components/views/elements/EffectsOverlay.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const EffectsOverlay: FunctionComponent<IProps> = ({ roomWidth }) => {
9090
top: 0,
9191
right: 0,
9292
}}
93+
aria-hidden={true}
9394
/>
9495
);
9596
};

src/components/views/elements/ImageView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,9 @@ export default class ImageView extends React.Component<IProps, IState> {
540540
<FocusLock
541541
returnFocus={true}
542542
lockProps={{
543-
onKeyDown: this.onKeyDown,
544-
role: "dialog",
543+
"onKeyDown": this.onKeyDown,
544+
"role": "dialog",
545+
"aria-label": _t("Image view"),
545546
}}
546547
className="mx_ImageView"
547548
ref={this.focusLock}

src/components/views/elements/SettingsFlag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
6262
}
6363

6464
private getSettingValue(): boolean {
65-
return SettingsStore.getValueAt(
65+
return !!SettingsStore.getValueAt(
6666
this.props.level,
6767
this.props.name,
6868
this.props.roomId ?? null,

src/components/views/elements/Slider.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ interface IProps {
3535

3636
// Whether the slider is disabled
3737
disabled: boolean;
38+
39+
label: string;
3840
}
3941

4042
const THUMB_SIZE = 2.4; // em
@@ -77,6 +79,7 @@ export default class Slider extends React.Component<IProps> {
7779
disabled={this.props.disabled}
7880
step={this.props.step}
7981
autoComplete="off"
82+
aria-label={this.props.label}
8083
/>
8184
{selection}
8285
</div>

src/components/views/messages/DateSeparator.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
322322
public render(): React.ReactNode {
323323
const label = this.getLabel();
324324

325-
let dateHeaderContent;
325+
let dateHeaderContent: JSX.Element;
326326
if (this.state.jumpToDateEnabled) {
327327
dateHeaderContent = this.renderJumpToDateMenu();
328328
} else {
@@ -336,9 +336,8 @@ export default class DateSeparator extends React.Component<IProps, IState> {
336336
}
337337

338338
// ARIA treats <hr/>s as separators, here we abuse them slightly so manually treat this entire thing as one
339-
// tab-index=-1 to allow it to be focusable but do not add tab stop for it, primarily for screen readers
340339
return (
341-
<div className="mx_DateSeparator" role="separator" tabIndex={-1} aria-label={label}>
340+
<div className="mx_DateSeparator" role="separator" aria-label={label}>
342341
<hr role="none" />
343342
{dateHeaderContent}
344343
<hr role="none" />

src/components/views/settings/FontScalingPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export default class FontScalingPanel extends React.Component<IProps, IState> {
128128
onChange={this.onFontSizeChanged}
129129
displayFunc={(_) => ""}
130130
disabled={this.state.useCustomFontSize}
131+
label={_t("Font size")}
131132
/>
132133
<div className="mx_FontScalingPanel_fontSlider_largeText">Aa</div>
133134
</div>

src/components/views/settings/devices/SelectableDeviceTile.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ const SelectableDeviceTile: React.FC<Props> = ({ children, device, isSelected, o
3535
className="mx_SelectableDeviceTile_checkbox"
3636
id={`device-tile-checkbox-${device.device_id}`}
3737
data-testid={`device-tile-checkbox-${device.device_id}`}
38-
/>
39-
<DeviceTile device={device} onClick={onClick} isSelected={isSelected}>
40-
{children}
41-
</DeviceTile>
38+
>
39+
<DeviceTile device={device} onClick={onClick} isSelected={isSelected}>
40+
{children}
41+
</DeviceTile>
42+
</StyledCheckbox>
4243
</div>
4344
);
4445
};

src/components/views/settings/tabs/room/NotificationSettingsTab.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
284284
onClick={chromeFileInputFix}
285285
onChange={this.onSoundUploadChanged}
286286
accept="audio/*"
287+
aria-label={_t("Upload custom sound")}
287288
/>
288289
</form>
289290

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,7 @@
17011701
"Sounds": "Sounds",
17021702
"Notification sound": "Notification sound",
17031703
"Set a new custom sound": "Set a new custom sound",
1704+
"Upload custom sound": "Upload custom sound",
17041705
"Browse": "Browse",
17051706
"Failed to unban": "Failed to unban",
17061707
"Unban": "Unban",
@@ -2600,6 +2601,7 @@
26002601
"%(oneUser)ssent %(count)s hidden messages|one": "%(oneUser)ssent a hidden message",
26012602
"collapse": "collapse",
26022603
"expand": "expand",
2604+
"Image view": "Image view",
26032605
"Rotate Left": "Rotate Left",
26042606
"Rotate Right": "Rotate Right",
26052607
"Information": "Information",

0 commit comments

Comments
 (0)