Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

hotkey: Ignore keydown events with `event.key=undefined`.

Prakhar Pratyush0be5ea715d0b
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index 7d414add2ab..4e5f65a9443 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -1432,6 +1432,14 @@ export function process_keydown(e) {
export function initialize() {
$(document).on("keydown", (e) => {
+ if (e.key === undefined) {
+ /* Some browsers trigger a 'keydown' event with `key === undefined`
+ on selecting autocomplete suggestion. These are not real keypresses
+ and can be safely ignored.
+ See: https://issues.chromium.org/issues/41425904
+ */
+ return;
+ }
if (process_keydown(e)) {
e.preventDefault();
}