Browse Source

Bugfix. Using enter to choose category caused TypeError

JC Brand 8 months ago
parent
commit
62cd095169
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/shared/chat/emoji-picker.js

+ 2 - 2
src/shared/chat/emoji-picker.js

@@ -205,8 +205,8 @@ export default class EmojiPicker extends CustomElement {
     chooseCategory (ev) {
         ev.preventDefault && ev.preventDefault();
         ev.stopPropagation && ev.stopPropagation();
-        const target = /** @type {Element} */(ev.target);
-        const el = target.matches('li') ? ev.target : u.ancestor(target, 'li');
+        const target = /** @type {Element} */(ev.target ?? ev.relatedTarget);
+        const el = target.matches('li') ? target : u.ancestor(target, 'li');
         this.setCategoryForElement(el);
         this.navigator.select(el);
         !this.navigator.enabled && this.navigator.enable();