From 34d18ac0c4e1903cb174df8957b855a048ec6b7e Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 25 Feb 2021 17:27:29 +0200 Subject: focus input in emoji picker and react picker --- src/components/emoji_input/emoji_input.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/components/emoji_input/emoji_input.js') diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 2068a598..cda2382e 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -194,11 +194,18 @@ const EmojiInput = { } }, methods: { + focusPickerInput () { + const pickerEl = this.$refs.picker.$el + if (!pickerEl) return + const pickerInput = pickerEl.querySelector('input') + if (pickerInput) pickerInput.focus() + }, triggerShowPicker () { this.showPicker = true this.$refs.picker.startEmojiLoad() this.$nextTick(() => { this.scrollIntoView() + this.focusPickerInput() }) // This temporarily disables "click outside" handler // since external trigger also means click originates @@ -214,6 +221,7 @@ const EmojiInput = { if (this.showPicker) { this.scrollIntoView() this.$refs.picker.startEmojiLoad() + this.$nextTick(() => this.focusPickerInput()) } }, replace (replacement) { -- cgit v1.2.3-70-g09d2 From acc08932cdc704fd875fbd66180c08c13c243c5e Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 25 Feb 2021 17:32:54 +0200 Subject: save a few characters --- src/components/emoji_input/emoji_input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/emoji_input/emoji_input.js') diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index cda2382e..dc03bc9f 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -221,7 +221,7 @@ const EmojiInput = { if (this.showPicker) { this.scrollIntoView() this.$refs.picker.startEmojiLoad() - this.$nextTick(() => this.focusPickerInput()) + this.$nextTick(this.focusPickerInput) } }, replace (replacement) { -- cgit v1.2.3-70-g09d2