You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-19 05:22:13 +03:00
Put aria-disabled on AccessibleButtons and attempt to a11y ToggleSwitch
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -69,8 +69,7 @@ export default function AccessibleButton(props) {
|
|||||||
|
|
||||||
restProps.tabIndex = restProps.tabIndex || "0";
|
restProps.tabIndex = restProps.tabIndex || "0";
|
||||||
restProps.role = "button";
|
restProps.role = "button";
|
||||||
restProps.className = (restProps.className ? restProps.className + " " : "") +
|
restProps.className = (restProps.className ? restProps.className + " " : "") + "mx_AccessibleButton";
|
||||||
"mx_AccessibleButton";
|
|
||||||
|
|
||||||
if (kind) {
|
if (kind) {
|
||||||
// We apply a hasKind class to maintain backwards compatibility with
|
// We apply a hasKind class to maintain backwards compatibility with
|
||||||
@@ -80,6 +79,7 @@ export default function AccessibleButton(props) {
|
|||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
restProps.className += " mx_AccessibleButton_disabled";
|
restProps.className += " mx_AccessibleButton_disabled";
|
||||||
|
restProps["aria-disabled"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return React.createElement(element, restProps, children);
|
return React.createElement(element, restProps, children);
|
||||||
|
|||||||
@@ -64,7 +64,12 @@ export default class ToggleSwitch extends React.Component {
|
|||||||
"mx_ToggleSwitch_enabled": !this.props.disabled,
|
"mx_ToggleSwitch_enabled": !this.props.disabled,
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div className={classes} onClick={this._onClick}>
|
<div
|
||||||
|
className={classes}
|
||||||
|
onClick={this._onClick}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={this.state.checked}
|
||||||
|
aria-disabled={this.props.disabled}>
|
||||||
<div className="mx_ToggleSwitch_ball" />
|
<div className="mx_ToggleSwitch_ball" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user