diff --git a/src/components/PlayPauseButton.js b/src/components/PlayPauseButton.js index 2dfacd5..065356f 100644 --- a/src/components/PlayPauseButton.js +++ b/src/components/PlayPauseButton.js @@ -14,6 +14,14 @@ class PlayPauseButton extends React.Component { handleOnTouchStart = () => !isBrowser && this.props.togglePlay(); + handleKeyDown = e => { + // Toggle play when user presses Enter + // The Space keypress event is ignored to avoid collision with the GlobalHotKeys + if (e.keyCode === 13) { + this.handleOnClick(); + } + }; + static getDerivedStateFromProps(nextProps, prevState) { // set initial load to render the initial message accordingly if (prevState.initialLoad && nextProps.playing) { @@ -25,10 +33,14 @@ class PlayPauseButton extends React.Component { render() { return (