Skip to content

Commit

Permalink
Improve light mode a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
Webmaster1116 committed May 23, 2020
1 parent 1a42cfd commit d9ed8e7
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 d9ed8e7

Please sign in to comment.