Browse Source

a11y: Improve icon button component regarding semantics and screen reader usage

closed-social-glitch-2
mhe 7 years ago
parent
commit
87aabeb7af
2 changed files with 5 additions and 4 deletions
  1. +3
    -3
      app/assets/javascripts/components/components/icon_button.jsx
  2. +2
    -1
      app/assets/stylesheets/components.scss

+ 3
- 3
app/assets/javascripts/components/components/icon_button.jsx View File

@ -35,9 +35,9 @@ const IconButton = React.createClass({
};
return (
<a href='#' title={this.props.title} className={`icon-button ${this.props.active ? 'active' : ''}`} onClick={this.handleClick} style={style}>
<i className={`fa fa-fw fa-${this.props.icon}`}></i>
</a>
<button aria-label={this.props.title} title={this.props.title} className={`icon-button ${this.props.active ? 'active' : ''}`} onClick={this.handleClick} style={style}>
<i className={`fa fa-fw fa-${this.props.icon}`} aria-hidden='true'></i>
</button>
);
}

+ 2
- 1
app/assets/stylesheets/components.scss View File

@ -42,7 +42,8 @@
.icon-button {
color: #616b86;
cursor: pointer;
border: none;
background: transparent;
&:hover {
color: #717b98;

Loading…
Cancel
Save