Skip to content

Commit

Permalink
Improve light mode a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
webmiraclepro committed May 22, 2020
1 parent 35fa6e7 commit f3802ce
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ export default class Preview extends Component {
})
}

handleKeyPress = e => {
if (e.key === 'Enter' || e.key === ' ') {
this.props.onClick()
}
}

render () {
const { onClick, playIcon } = this.props
const { image } = this.state
Expand Down Expand Up @@ -78,7 +84,13 @@ export default class Preview extends Component {
</div>
)
return (
<div style={styles.preview} className='react-player__preview' onClick={onClick}>
<div
style={styles.preview}
className='react-player__preview'
onClick={onClick}
tabIndex={0}
onKeyPress={this.handleKeyPress}
>
{playIcon || defaultPlayIcon}
</div>
)
Expand Down

0 comments on commit f3802ce

Please sign in to comment.