Skip to content

Commit

Permalink
Merge pull request #2270 from storybooks/fix-accessibility-warnings
Browse files Browse the repository at this point in the history
Fix accessibility warnings
  • Loading branch information
Hypnosphi authored Nov 9, 2017
2 parents f48fbd3 + 36c7eb8 commit 7f535b4
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = {
'jsx-a11y/accessible-emoji': ignore,
'jsx-a11y/href-no-hash': ignore,
'jsx-a11y/label-has-for': ignore,
'jsx-a11y/click-events-have-key-events': warn,
'jsx-a11y/click-events-have-key-events': error,
'jsx-a11y/anchor-is-valid': [warn, { aspects: ['invalidHref'] }],
'react/no-unescaped-entities': ignore,
},
Expand Down
4 changes: 2 additions & 2 deletions addons/comments/src/manager/components/CommentItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export default class CommentItem extends Component {

renderDelete() {
return (
<a style={style.commentDelete} onClick={this.deleteComment} role="button" tabIndex="0">
<button type="button" style={style.commentDelete} onClick={this.deleteComment}>
delete
</a>
</button>
);
}

Expand Down
3 changes: 3 additions & 0 deletions addons/comments/src/manager/components/CommentItem/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ export default {
right: 0,
fontSize: 11,
color: 'rgb(200, 200, 200)',
border: 'none',
background: 'transparent',
padding: 0,
},
};
18 changes: 9 additions & 9 deletions addons/info/src/components/Story.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ global.STORYBOOK_REACT_CLASSES = global.STORYBOOK_REACT_CLASSES || [];
const { STORYBOOK_REACT_CLASSES } = global;

const stylesheet = {
link: {
button: {
base: {
fontFamily: 'sans-serif',
fontSize: '12px',
display: 'block',
position: 'fixed',
textDecoration: 'none',
border: 'none',
background: '#28c',
color: '#fff',
padding: '5px 15px',
Expand Down Expand Up @@ -149,9 +149,9 @@ export default class Story extends React.Component {
}

_renderOverlay() {
const linkStyle = {
...stylesheet.link.base,
...stylesheet.link.topRight,
const buttonStyle = {
...stylesheet.button.base,
...stylesheet.button.topRight,
};

const infoStyle = Object.assign({}, stylesheet.info);
Expand All @@ -172,13 +172,13 @@ export default class Story extends React.Component {
return (
<div>
<div style={this.state.stylesheet.children}>{this.props.children}</div>
<a style={linkStyle} onClick={openOverlay} role="button" tabIndex="0">
<button type="button" style={buttonStyle} onClick={openOverlay}>
Show Info
</a>
</button>
<div style={infoStyle}>
<a style={linkStyle} onClick={closeOverlay} role="button" tabIndex="0">
<button type="button" style={buttonStyle} onClick={closeOverlay}>
×
</a>
</button>
<div style={this.state.stylesheet.infoPage}>
<div style={this.state.stylesheet.infoBody}>
{this._getInfoHeader()}
Expand Down
5 changes: 3 additions & 2 deletions addons/knobs/src/components/types/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const styles = {
display: 'inline-block',
cursor: 'pointer',
width: '100%',
padding: 0,
},
popover: {
position: 'absolute',
Expand Down Expand Up @@ -71,9 +72,9 @@ class ColorType extends React.Component {
};
return (
<div id={knob.name}>
<div style={styles.swatch} onClick={this.handleClick} role="button" tabIndex="0">
<button type="button" style={styles.swatch} onClick={this.handleClick}>
<div style={colorStyle} />
</div>
</button>
{conditionalRender(
displayColorPicker,
() => (
Expand Down
Loading

0 comments on commit 7f535b4

Please sign in to comment.