浏览代码

Make sure the emoji picker is focused...

the first time it's opened
JC Brand 5 年之前
父节点
当前提交
54ffd90087
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      src/components/emoji-picker.js

+ 7 - 6
src/components/emoji-picker.js

@@ -283,9 +283,10 @@ export class EmojiDropdown extends BaseDropdown {
                         data-toggle="dropdown"
                         aria-haspopup="true"
                         aria-expanded="false">
-                    <converse-icon class="fa fa-smile "
-                             path-prefix="${api.settings.get('assets_path')}"
-                             size="1em"></converse-icon>
+                    <converse-icon
+                        class="fa fa-smile "
+                        path-prefix="${api.settings.get('assets_path')}"
+                        size="1em"></converse-icon>
                 </button>
                 <div class="dropdown-menu">
                     ${until(this.initModel().then(() => html`
@@ -314,14 +315,14 @@ export class EmojiDropdown extends BaseDropdown {
     }
 
     async showMenu () {
-        await this.init_promise;
+        await this.initModel();
         if (!this.render_emojis) {
             // Trigger an update so that emojis are rendered
             this.render_emojis = true;
-            this.requestUpdate();
+            await this.requestUpdate();
         }
         super.showMenu();
-        this.querySelector('.emoji-search')?.focus();
+        setTimeout(() => this.querySelector('.emoji-search')?.focus());
     }
 }