use const for space bar key code

This commit is contained in:
Sean Yesmunt 2018-05-16 15:34:38 -04:00
parent 2cf9d829b4
commit 6157dbd9fe

View file

@ -7,6 +7,8 @@ import VideoPlayer from './internal/player';
import VideoPlayButton from './internal/play-button';
import LoadingScreen from './internal/loading-screen';
const SPACE_BAR_KEYCODE = 32;
type Props = {
cancelPlay: () => void,
fileInfo: {
@ -71,7 +73,7 @@ class Video extends React.PureComponent<Props> {
handleKeyDown(event: SyntheticKeyboardEvent<*>) {
const { searchBarFocused } = this.props;
if (!searchBarFocused && event.keyCode === 32) {
if (!searchBarFocused && event.keyCode === SPACE_BAR_KEYCODE) {
event.preventDefault(); // prevent page scroll
this.playContent();
}