diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-08 19:32:44 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-08 19:32:44 -0400 |
commit | 9d488e1916f60ca03ccbff511f810753176d9023 (patch) | |
tree | 8e624d775f8c15421f23faa7cf674c133213601d | |
parent | 176f6a248b5f2b4487d760b73221c0fbc90ab4cf (diff) |
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.
-rw-r--r-- | ext/mixed/js/display.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 575011fd..228e554a 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -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) : ''); } } |