diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 5647a9eb..b648b50c 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -213,7 +213,9 @@ const PostStatusForm = { preview: null, previewLoading: false, emojiInputShown: false, - idempotencyKey: '' + idempotencyKey: '', + activeEmojiInput: undefined, + activeTextInput: undefined } }, computed: { @@ -674,8 +676,19 @@ const PostStatusForm = { this.$refs['emoji-input'].resize() }, showEmojiPicker () { - this.$refs['textarea'].focus() - this.$refs['emoji-input'].triggerShowPicker() + if (!this.activeEmojiInput || !this.activeTextInput) + this.focusStatusInput() + + this.$refs[this.activeTextInput].focus() + this.$refs[this.activeEmojiInput].triggerShowPicker() + }, + focusStatusInput() { + this.activeEmojiInput = 'emoji-input' + this.activeTextInput = 'textarea' + }, + focusSubjectInput() { + this.activeEmojiInput = 'subject-emoji-input' + this.activeTextInput = 'subject-input' }, clearError () { this.error = null diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index f4680336..601b7d0c 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -118,13 +118,16 @@ /> </div> <EmojiInput + ref="subject-emoji-input" v-if="!disableSubject && (newStatus.spoilerText || alwaysShowSubject)" v-model="newStatus.spoilerText" enable-emoji-picker + hide-emoji-button :suggest="emojiSuggestor" class="form-control" > <input + ref="subject-input" v-model="newStatus.spoilerText" type="text" :placeholder="$t('post_status.content_warning')" @@ -132,6 +135,7 @@ size="1" class="form-post-subject" @input="onSubjectInput" + @focus="focusSubjectInput()" > </EmojiInput> <i18n-t @@ -173,6 +177,7 @@ @input="resize" @compositionupdate="resize" @paste="paste" + @focus="focusStatusInput()" /> <p v-if="hasStatusLengthLimit"