commit: 692342a77f1b91a88a30aadfd20994c293ad65e0
parent d2fabe1a71207f92e10283fc5a881d883cb52ae1
Author: Henry Jameson <me@hjkos.com>
Date: Mon, 10 Oct 2022 20:11:04 +0300
focus search input when opening emoji picker
Diffstat:
3 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js
@@ -278,17 +278,10 @@ const EmojiInput = {
}
},
methods: {
- focusPickerInput () {
- const pickerEl = this.$refs.picker.$el
- if (!pickerEl) return
- const pickerInput = pickerEl.querySelector('input')
- if (pickerInput) pickerInput.focus()
- },
triggerShowPicker () {
this.$nextTick(() => {
this.$refs.picker.showPicker()
this.scrollIntoView()
- this.focusPickerInput()
})
// This temporarily disables "click outside" handler
// since external trigger also means click originates
@@ -306,7 +299,6 @@ const EmojiInput = {
this.scrollIntoView()
this.$refs.picker.showPicker()
this.$refs.picker.startEmojiLoad()
- this.$nextTick(this.focusPickerInput)
} else {
this.$refs.picker.hidePicker()
}
diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js
@@ -245,6 +245,7 @@ const EmojiPicker = {
this.filteredEmojiGroups = this.getFilteredEmojiGroups()
if (!oldContentLoaded) {
this.$nextTick(() => {
+ this.$refs.search.focus()
if (this.defaultGroup) {
this.highlight(this.defaultGroup)
}
diff --git a/src/components/emoji_picker/emoji_picker.vue b/src/components/emoji_picker/emoji_picker.vue
@@ -71,6 +71,7 @@
class="form-control"
:placeholder="$t('emoji.search_emoji')"
@input="$event.target.composing = false"
+ ref="search"
>
</div>
<div