Skip to content

Commit c28d9e5

Browse files
authored
Merge pull request element-hq#5661 from pafcu/sidebar-a11y
Add some aria-labels to RightPanel
2 parents f2e6659 + 0bd68ce commit c28d9e5

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/components/structures/RightPanel.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,19 @@ class HeaderButton extends React.Component {
4949
const TintableSvg = sdk.getComponent("elements.TintableSvg");
5050
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
5151

52-
return <AccessibleButton className="mx_RightPanel_headerButton" onClick={this.onClick} >
53-
<div className="mx_RightPanel_headerButton_badge">
54-
{ this.props.badge ? this.props.badge : <span>&nbsp;</span> }
55-
</div>
56-
<TintableSvg src={this.props.iconSrc} width="25" height="25"/>
57-
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> }
58-
</AccessibleButton>;
52+
return <AccessibleButton
53+
aria-label={this.props.title}
54+
title={this.props.title}
55+
className="mx_RightPanel_headerButton"
56+
onClick={this.onClick} >
57+
58+
<div className="mx_RightPanel_headerButton_badge">
59+
{ this.props.badge ? this.props.badge : <span>&nbsp;</span> }
60+
</div>
61+
<TintableSvg src={this.props.iconSrc} width="25" height="25"/>
62+
{ this.props.isHighlighted ? <div className="mx_RightPanel_headerButton_highlight"></div> : <div/> }
63+
64+
</AccessibleButton>;
5965
}
6066
}
6167

@@ -71,6 +77,9 @@ HeaderButton.propTypes = {
7177
badge: PropTypes.node,
7278
// The parameters to track the click event
7379
analytics: PropTypes.arrayOf(PropTypes.string).isRequired,
80+
81+
// Button title
82+
title: PropTypes.string.isRequired,
7483
};
7584

7685
module.exports = React.createClass({
@@ -329,7 +338,7 @@ module.exports = React.createClass({
329338
// button on these 2 screens or you won't be able to re-expand the panel.
330339
headerButtons.push(
331340
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton"
332-
title={ _t("Hide panel") } onClick={ this.onCollapseClick }
341+
title={ _t("Hide panel") } aria-label={ _t("Hide panel") } onClick={ this.onCollapseClick }
333342
>
334343
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
335344
</div>,

0 commit comments

Comments
 (0)