Skip to content

Commit

Permalink
Improve light mode a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-luther committed Nov 22, 2024
1 parent 736beaa commit 56d650e
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 56d650e

Please sign in to comment.