diff --git a/app/javascript/vue/shared/select.vue b/app/javascript/vue/shared/select.vue index c8074a2a7..3a001f828 100644 --- a/app/javascript/vue/shared/select.vue +++ b/app/javascript/vue/shared/select.vue @@ -21,7 +21,6 @@ class="sn-select__options !relative !top-0 !left-[-1px] !shadow-none scroll-container px-2.5 pt-0 block" :class="{ [optionsClassName]: true }" > -
o[0] === this.value); return option && option[1]; - }, - focusElement() { - return this.$refs.focusElement || this.$parent.$refs.focusElement; } }, mounted() { @@ -96,7 +92,8 @@ if (this.isOpen) { this.$emit('open'); this.$nextTick(() => { - this.focusElement.focus(); + this.$emit('focus'); + this.$refs.focusElement?.focus(); }); this.$refs.optionsContainer.scrollTop = 0; this.updateOptionPosition(); diff --git a/app/javascript/vue/shared/select_search.vue b/app/javascript/vue/shared/select_search.vue index d0aea0be0..b206babe2 100644 --- a/app/javascript/vue/shared/select_search.vue +++ b/app/javascript/vue/shared/select_search.vue @@ -15,6 +15,7 @@ @blur="blur" @open="open" @close="close" + @focus="focus" > {{ valueLabel || (placeholder || i18n.t('general.select')) }} @@ -77,6 +78,9 @@ } }, methods: { + focus() { + this.$refs.focusElement.focus(); + }, blur() { this.isOpen = false; this.$emit('blur');