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" >
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'
158159import { getMyErrors } from ' src/store/validator'
159160import { 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