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
This commit is contained in:
Michael Telatynski 2023-04-17 17:09:45 +01:00 committed by GitHub
parent 270a26d89a
commit 1a0e5c1805
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 210 additions and 194 deletions

View file

@ -90,6 +90,7 @@ const EffectsOverlay: FunctionComponent<IProps> = ({ roomWidth }) => {
top: 0,
right: 0,
}}
aria-hidden={true}
/>
);
};

View file

@ -540,8 +540,9 @@ export default class ImageView extends React.Component<IProps, IState> {
<FocusLock
returnFocus={true}
lockProps={{
onKeyDown: this.onKeyDown,
role: "dialog",
"onKeyDown": this.onKeyDown,
"role": "dialog",
"aria-label": _t("Image view"),
}}
className="mx_ImageView"
ref={this.focusLock}

View file

@ -62,7 +62,7 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
}
private getSettingValue(): boolean {
return SettingsStore.getValueAt(
return !!SettingsStore.getValueAt(
this.props.level,
this.props.name,
this.props.roomId ?? null,

View file

@ -35,6 +35,8 @@ interface IProps {
// Whether the slider is disabled
disabled: boolean;
label: string;
}
const THUMB_SIZE = 2.4; // em
@ -77,6 +79,7 @@ export default class Slider extends React.Component<IProps> {
disabled={this.props.disabled}
step={this.props.step}
autoComplete="off"
aria-label={this.props.label}
/>
{selection}
</div>

View file

@ -322,7 +322,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
public render(): React.ReactNode {
const label = this.getLabel();
let dateHeaderContent;
let dateHeaderContent: JSX.Element;
if (this.state.jumpToDateEnabled) {
dateHeaderContent = this.renderJumpToDateMenu();
} else {
@ -336,9 +336,8 @@ export default class DateSeparator extends React.Component<IProps, IState> {
}
// ARIA treats <hr/>s as separators, here we abuse them slightly so manually treat this entire thing as one
// tab-index=-1 to allow it to be focusable but do not add tab stop for it, primarily for screen readers
return (
<div className="mx_DateSeparator" role="separator" tabIndex={-1} aria-label={label}>
<div className="mx_DateSeparator" role="separator" aria-label={label}>
<hr role="none" />
{dateHeaderContent}
<hr role="none" />

View file

@ -128,6 +128,7 @@ export default class FontScalingPanel extends React.Component<IProps, IState> {
onChange={this.onFontSizeChanged}
displayFunc={(_) => ""}
disabled={this.state.useCustomFontSize}
label={_t("Font size")}
/>
<div className="mx_FontScalingPanel_fontSlider_largeText">Aa</div>
</div>

View file

@ -35,10 +35,11 @@ const SelectableDeviceTile: React.FC<Props> = ({ children, device, isSelected, o
className="mx_SelectableDeviceTile_checkbox"
id={`device-tile-checkbox-${device.device_id}`}
data-testid={`device-tile-checkbox-${device.device_id}`}
/>
<DeviceTile device={device} onClick={onClick} isSelected={isSelected}>
{children}
</DeviceTile>
>
<DeviceTile device={device} onClick={onClick} isSelected={isSelected}>
{children}
</DeviceTile>
</StyledCheckbox>
</div>
);
};

View file

@ -284,6 +284,7 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
onClick={chromeFileInputFix}
onChange={this.onSoundUploadChanged}
accept="audio/*"
aria-label={_t("Upload custom sound")}
/>
</form>