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

Fix multiple accessibility defects identified by AXE #10606

Merged
merged 7 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ limitations under the License.
}

.mx_SelectableDeviceTile_checkbox {
flex: 0 0;
margin-right: $spacing-16;
flex: 1 0;

.mx_Checkbox_background + div {
flex: 1 0;
/* override more specific selector */
margin-left: $spacing-16 !important;
}
}
1 change: 1 addition & 0 deletions src/components/views/elements/EffectsOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const EffectsOverlay: FunctionComponent<IProps> = ({ roomWidth }) => {
top: 0,
right: 0,
}}
aria-hidden={true}
/>
);
};
Expand Down
5 changes: 3 additions & 2 deletions src/components/views/elements/ImageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/elements/SettingsFlag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/components/views/elements/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ interface IProps {

// Whether the slider is disabled
disabled: boolean;

label: string;
}

const THUMB_SIZE = 2.4; // em
Expand Down Expand Up @@ -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>
Expand Down
5 changes: 2 additions & 3 deletions src/components/views/messages/DateSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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" />
Expand Down
1 change: 1 addition & 0 deletions src/components/views/settings/FontScalingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 2 additions & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,7 @@
"Sounds": "Sounds",
"Notification sound": "Notification sound",
"Set a new custom sound": "Set a new custom sound",
"Upload custom sound": "Upload custom sound",
"Browse": "Browse",
"Failed to unban": "Failed to unban",
"Unban": "Unban",
Expand Down Expand Up @@ -2596,6 +2597,7 @@
"%(oneUser)ssent %(count)s hidden messages|one": "%(oneUser)ssent a hidden message",
"collapse": "collapse",
"expand": "expand",
"Image view": "Image view",
"Rotate Left": "Rotate Left",
"Rotate Right": "Rotate Right",
"Information": "Information",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ exports[`MessagePanel should handle lots of membership events quickly 1`] = `
aria-label="Thu, Jan 1 1970"
class="mx_DateSeparator"
role="separator"
tabindex="-1"
>
<hr
role="none"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ exports[`<MessageEditHistory /> should match the snapshot 1`] = `
aria-label="Thu, Jan 1 1970"
class="mx_DateSeparator"
role="separator"
tabindex="-1"
>
<hr
role="none"
Expand Down Expand Up @@ -165,7 +164,6 @@ exports[`<MessageEditHistory /> should support events with 1`] = `
aria-label=", NaN NaN"
class="mx_DateSeparator"
role="separator"
tabindex="-1"
>
<hr
role="none"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exports[`DateSeparator renders the date separator correctly 1`] = `
aria-label="Today"
class="mx_DateSeparator"
role="separator"
tabindex="-1"
>
<hr
role="none"
Expand Down Expand Up @@ -34,7 +33,6 @@ exports[`DateSeparator when feature_jump_to_date is enabled renders the date sep
aria-label="Fri, Dec 17 2021"
class="mx_DateSeparator"
role="separator"
tabindex="-1"
>
<hr
role="none"
Expand Down
Loading