Add some aria-labels to RightPanel

Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
This commit is contained in:
Stefan Parviainen 2017-11-21 09:18:59 +01:00
parent f2e66590da
commit 0bd68ce068
1 changed files with 17 additions and 8 deletions

View File

@ -49,12 +49,18 @@ class HeaderButton extends React.Component {
const TintableSvg = sdk.getComponent("elements.TintableSvg"); const TintableSvg = sdk.getComponent("elements.TintableSvg");
const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
return <AccessibleButton className="mx_RightPanel_headerButton" onClick={this.onClick} > return <AccessibleButton
aria-label={this.props.title}
title={this.props.title}
className="mx_RightPanel_headerButton"
onClick={this.onClick} >
<div className="mx_RightPanel_headerButton_badge"> <div className="mx_RightPanel_headerButton_badge">
{ this.props.badge ? this.props.badge : <span>&nbsp;</span> } { this.props.badge ? this.props.badge : <span>&nbsp;</span> }
</div> </div>
<TintableSvg src={this.props.iconSrc} width="25" height="25"/> <TintableSvg src={this.props.iconSrc} width="25" height="25"/>
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> } { this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> }
</AccessibleButton>; </AccessibleButton>;
} }
} }
@ -71,6 +77,9 @@ HeaderButton.propTypes = {
badge: PropTypes.node, badge: PropTypes.node,
// The parameters to track the click event // The parameters to track the click event
analytics: PropTypes.arrayOf(PropTypes.string).isRequired, analytics: PropTypes.arrayOf(PropTypes.string).isRequired,
// Button title
title: PropTypes.string.isRequired,
}; };
module.exports = React.createClass({ module.exports = React.createClass({
@ -329,7 +338,7 @@ module.exports = React.createClass({
// button on these 2 screens or you won't be able to re-expand the panel. // button on these 2 screens or you won't be able to re-expand the panel.
headerButtons.push( headerButtons.push(
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton" <div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton"
title={ _t("Hide panel") } onClick={ this.onCollapseClick } title={ _t("Hide panel") } aria-label={ _t("Hide panel") } onClick={ this.onCollapseClick }
> >
<TintableSvg src="img/minimise.svg" width="10" height="16"/> <TintableSvg src="img/minimise.svg" width="10" height="16"/>
</div>, </div>,