Merge pull request #2247 from spl237/keyboard

Add enter key to list of keyboard events detected.
This commit is contained in:
Eric Rosenbaum 2019-08-15 14:47:41 -04:00 committed by GitHub
commit 0052383657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,8 @@ const KEY_NAME = {
LEFT: 'left arrow', LEFT: 'left arrow',
UP: 'up arrow', UP: 'up arrow',
RIGHT: 'right arrow', RIGHT: 'right arrow',
DOWN: 'down arrow' DOWN: 'down arrow',
ENTER: 'enter'
}; };
/** /**
@ -56,6 +57,7 @@ class Keyboard {
case 'ArrowRight': return KEY_NAME.RIGHT; case 'ArrowRight': return KEY_NAME.RIGHT;
case 'Down': case 'Down':
case 'ArrowDown': return KEY_NAME.DOWN; case 'ArrowDown': return KEY_NAME.DOWN;
case 'Enter': return KEY_NAME.ENTER;
} }
// Ignore modifier keys // Ignore modifier keys
if (keyString.length > 1) { if (keyString.length > 1) {