diff --git a/client/components/modals/EditSeriesInputInnerModal.vue b/client/components/modals/EditSeriesInputInnerModal.vue index fb540105..c09a6f99 100644 --- a/client/components/modals/EditSeriesInputInnerModal.vue +++ b/client/components/modals/EditSeriesInputInnerModal.vue @@ -8,10 +8,10 @@
- +
- +
@@ -59,9 +59,26 @@ export default { set(val) { this.$emit('input', val) } + }, + isNewSeries() { + if (!this.selectedSeries || !this.selectedSeries.id) return false + return this.selectedSeries.id.startsWith('new') } }, methods: { + setInputFocus() { + if (this.isNewSeries) { + // Focus on series input if new series + if (this.$refs.newSeriesSelect) { + this.$refs.newSeriesSelect.setFocus() + } + } else { + // Focus on sequence input if existing series + if (this.$refs.sequenceInput) { + this.$refs.sequenceInput.setFocus() + } + } + }, submitSeriesForm() { if (this.$refs.newSeriesSelect) { this.$refs.newSeriesSelect.blur() @@ -92,6 +109,8 @@ export default { this.$store.commit('setInnerModalOpen', true) this.$eventBus.$on('modal-hotkey', this.hotkey) + + this.setInputFocus() }, setHide() { if (this.content) this.content.style.transform = 'scale(0)' diff --git a/client/components/ui/InputDropdown.vue b/client/components/ui/InputDropdown.vue index 3efd2cf5..32abe07a 100644 --- a/client/components/ui/InputDropdown.vue +++ b/client/components/ui/InputDropdown.vue @@ -89,6 +89,9 @@ export default { // this.currentSearch = this.textInput }, 100) }, + setFocus() { + if (this.$refs.input && this.editable) this.$refs.input.focus() + }, inputFocus() { this.isFocused = true }, diff --git a/client/components/ui/TextInput.vue b/client/components/ui/TextInput.vue index 38c4e458..7943e288 100644 --- a/client/components/ui/TextInput.vue +++ b/client/components/ui/TextInput.vue @@ -80,6 +80,9 @@ export default { blur() { if (this.$refs.input) this.$refs.input.blur() }, + setFocus() { + if (this.$refs.input) this.$refs.input.focus() + }, mouseover() { this.isHovering = true }, diff --git a/client/components/ui/TextInputWithLabel.vue b/client/components/ui/TextInputWithLabel.vue index b464a467..c251555d 100644 --- a/client/components/ui/TextInputWithLabel.vue +++ b/client/components/ui/TextInputWithLabel.vue @@ -34,6 +34,11 @@ export default { } }, methods: { + setFocus() { + if (this.$refs.input && this.$refs.input.setFocus) { + this.$refs.input.setFocus() + } + }, blur() { if (this.$refs.input && this.$refs.input.blur) { this.$refs.input.blur()