mirror of https://github.com/vector-im/riot-web
improve Settings Accessibility for Toggles and Dialogs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
4a5ee4a969
commit
e01be212e6
|
@ -26,6 +26,7 @@ import { MatrixClient } from 'matrix-js-sdk';
|
||||||
import { KeyCode } from '../../../Keyboard';
|
import { KeyCode } from '../../../Keyboard';
|
||||||
import AccessibleButton from '../elements/AccessibleButton';
|
import AccessibleButton from '../elements/AccessibleButton';
|
||||||
import MatrixClientPeg from '../../../MatrixClientPeg';
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
|
import { _t } from "../../../languageHandler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic container for modal dialogs.
|
* Basic container for modal dialogs.
|
||||||
|
@ -114,8 +115,9 @@ export default createReactClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
let cancelButton;
|
let cancelButton;
|
||||||
if (this.props.hasCancel) {
|
if (this.props.hasCancel) {
|
||||||
cancelButton = <AccessibleButton onClick={this._onCancelClick} className="mx_Dialog_cancelButton">
|
cancelButton = (
|
||||||
</AccessibleButton>;
|
<AccessibleButton onClick={this._onCancelClick} className="mx_Dialog_cancelButton" aria-label={_t("Close dialog")} />
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default class LabelledToggleSwitch extends React.Component {
|
||||||
|
|
||||||
let firstPart = <span className="mx_SettingsFlag_label">{this.props.label}</span>;
|
let firstPart = <span className="mx_SettingsFlag_label">{this.props.label}</span>;
|
||||||
let secondPart = <ToggleSwitch checked={this.props.value} disabled={this.props.disabled}
|
let secondPart = <ToggleSwitch checked={this.props.value} disabled={this.props.disabled}
|
||||||
onChange={this.props.onChange} />;
|
onChange={this.props.onChange} aria-label={this.props.label} />;
|
||||||
|
|
||||||
if (this.props.toggleInFront) {
|
if (this.props.toggleInFront) {
|
||||||
const temp = firstPart;
|
const temp = firstPart;
|
||||||
|
|
|
@ -78,7 +78,7 @@ module.exports = createReactClass({
|
||||||
return (
|
return (
|
||||||
<div className="mx_SettingsFlag">
|
<div className="mx_SettingsFlag">
|
||||||
<span className="mx_SettingsFlag_label">{label}</span>
|
<span className="mx_SettingsFlag_label">{label}</span>
|
||||||
<ToggleSwitch checked={value} onChange={this.onChange} disabled={!canChange} />
|
<ToggleSwitch checked={value} onChange={this.onChange} disabled={!canChange} aria-label={label} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,6 +58,9 @@ export default class ToggleSwitch extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const {checked, disabled, onChange, ...props} = this.props;
|
||||||
|
|
||||||
const classes = classNames({
|
const classes = classNames({
|
||||||
"mx_ToggleSwitch": true,
|
"mx_ToggleSwitch": true,
|
||||||
"mx_ToggleSwitch_on": this.state.checked,
|
"mx_ToggleSwitch_on": this.state.checked,
|
||||||
|
@ -65,11 +68,13 @@ export default class ToggleSwitch extends React.Component {
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
{...props}
|
||||||
className={classes}
|
className={classes}
|
||||||
onClick={this._onClick}
|
onClick={this._onClick}
|
||||||
role="checkbox"
|
role="checkbox"
|
||||||
aria-checked={this.state.checked}
|
aria-checked={this.state.checked}
|
||||||
aria-disabled={this.props.disabled}>
|
aria-disabled={disabled}
|
||||||
|
tabIndex={0}>
|
||||||
<div className="mx_ToggleSwitch_ball" />
|
<div className="mx_ToggleSwitch_ball" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1205,6 +1205,7 @@
|
||||||
"Unable to find profiles for the Matrix IDs listed below - would you like to invite them anyway?": "Unable to find profiles for the Matrix IDs listed below - would you like to invite them anyway?",
|
"Unable to find profiles for the Matrix IDs listed below - would you like to invite them anyway?": "Unable to find profiles for the Matrix IDs listed below - would you like to invite them anyway?",
|
||||||
"Invite anyway and never warn me again": "Invite anyway and never warn me again",
|
"Invite anyway and never warn me again": "Invite anyway and never warn me again",
|
||||||
"Invite anyway": "Invite anyway",
|
"Invite anyway": "Invite anyway",
|
||||||
|
"Close dialog": "Close dialog",
|
||||||
"Please tell us what went wrong or, better, create a GitHub issue that describes the problem.": "Please tell us what went wrong or, better, create a GitHub issue that describes the problem.",
|
"Please tell us what went wrong or, better, create a GitHub issue that describes the problem.": "Please tell us what went wrong or, better, create a GitHub issue that describes the problem.",
|
||||||
"Preparing to send logs": "Preparing to send logs",
|
"Preparing to send logs": "Preparing to send logs",
|
||||||
"Logs sent": "Logs sent",
|
"Logs sent": "Logs sent",
|
||||||
|
|
Loading…
Reference in New Issue