Skip to content

Commit

Permalink
Merge pull request #5661 from pafcu/sidebar-a11y
Browse files Browse the repository at this point in the history
Add some aria-labels to RightPanel
  • Loading branch information
ara4n authored Nov 21, 2017
2 parents f2e6659 + 0bd68ce commit c28d9e5
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/components/structures/RightPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ class HeaderButton extends React.Component {
const TintableSvg = sdk.getComponent("elements.TintableSvg");
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");

return <AccessibleButton className="mx_RightPanel_headerButton" onClick={this.onClick} >
<div className="mx_RightPanel_headerButton_badge">
{ this.props.badge ? this.props.badge : <span>&nbsp;</span> }
</div>
<TintableSvg src={this.props.iconSrc} width="25" height="25"/>
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> }
</AccessibleButton>;
return <AccessibleButton
aria-label={this.props.title}
title={this.props.title}
className="mx_RightPanel_headerButton"
onClick={this.onClick} >

<div className="mx_RightPanel_headerButton_badge">
{ this.props.badge ? this.props.badge : <span>&nbsp;</span> }
</div>
<TintableSvg src={this.props.iconSrc} width="25" height="25"/>
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> }

</AccessibleButton>;
}
}

Expand All @@ -71,6 +77,9 @@ HeaderButton.propTypes = {
badge: PropTypes.node,
// The parameters to track the click event
analytics: PropTypes.arrayOf(PropTypes.string).isRequired,

// Button title
title: PropTypes.string.isRequired,
};

module.exports = React.createClass({
Expand Down Expand Up @@ -329,7 +338,7 @@ module.exports = React.createClass({
// button on these 2 screens or you won't be able to re-expand the panel.
headerButtons.push(
<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"/>
</div>,
Expand Down

0 comments on commit c28d9e5

Please sign in to comment.