Skip to content

Commit 020b8e2

Browse files
authored
Merge pull request #424 from citation-file-format/397_focus_input
2 parents 0481fc8 + 7958e19 commit 020b8e2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/components/AuthorCardEditing.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
v-bind:error="givenNamesError.hasError"
1818
v-bind:error-message="givenNamesError.messages.join(', ')"
1919
v-on:update:modelValue="$emit('update', 'givenNames', $event)"
20+
ref="givenNamesRef"
2021
/>
2122
</div>
2223
<div class="row">
@@ -154,7 +155,7 @@
154155

155156
<script lang="ts">
156157
/* eslint-disable @typescript-eslint/restrict-template-expressions */
157-
import { computed, defineComponent } from 'vue'
158+
import { computed, defineComponent, onMounted, ref } from 'vue'
158159
import { getMyErrors } from 'src/store/validator'
159160
import { authorErrors } from 'src/author-errors'
160161
@@ -199,7 +200,12 @@ export default defineComponent({
199200
}
200201
},
201202
setup (props) {
203+
const givenNamesRef = ref<HTMLElement | null>(null)
204+
onMounted(() => {
205+
givenNamesRef.value?.focus()
206+
})
202207
return {
208+
givenNamesRef,
203209
givenNamesError: computed(() => getMyErrors(`/authors/${props.index}/given-names`)),
204210
nameParticleError: computed(() => getMyErrors(`/authors/${props.index}/name-particle`)),
205211
familyNamesError: computed(() => getMyErrors(`/authors/${props.index}/family-names`)),
@@ -208,6 +214,7 @@ export default defineComponent({
208214
affiliationError: computed(() => getMyErrors(`/authors/${props.index}/affiliation`)),
209215
orcidError: computed(() => getMyErrors(`/authors/${props.index}/orcid`)),
210216
authorErrors: computed(() => authorErrors(props.index))
217+
211218
}
212219
},
213220
emits: ['closePressed', 'removePressed', 'update', 'moveUp', 'moveDown']

0 commit comments

Comments
 (0)