Validate that key is a string

On Chrome, when clicking an autocomplete dropdown menu option, a keydown event is generated which is not of type KeyboardEvent.
This commit is contained in:
toasted-nutbread 2019-10-08 19:32:44 -04:00
parent 176f6a248b
commit 9d488e1916

View File

@ -539,7 +539,7 @@ class Display {
static getKeyFromEvent(event) {
const key = event.key;
return key.length === 1 ? key.toUpperCase() : key;
return (typeof key === 'string' ? (key.length === 1 ? key.toUpperCase() : key) : '');
}
}