Skip to content

Commit

Permalink
a11y: la modale de modification de parcelle est focusée à l'ouverture
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed May 21, 2024
1 parent 874baaf commit c2cdef4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Features/SingleItemCertificationBodyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="fr-input-group" :class="{ 'fr-input-group--error': nameErrors.size }">
<label class="fr-label" for="feature-nom">Nom de la parcelle</label>
<span class="fr-hint-text fr-mb-1v">Exemple&nbsp;: Les charrons 2</span>
<input class="fr-input" id="feature-nom" v-model="patch.NOM" :required="requiredName" :class="{ 'fr-input--error': nameErrors.size }" />
<input class="fr-input" id="feature-nom" v-model="patch.NOM" :required="requiredName" :class="{ 'fr-input--error': nameErrors.size }" ref="autofocusedInput" />
<div v-for="([id, result]) in nameErrors" :key="id" class="fr-hint-text fr-error-text">
{{ result.errorMessage }}.
</div>
Expand Down Expand Up @@ -63,7 +63,8 @@
</template>

<script setup>
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue';
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'
import { useFocus } from '@vueuse/core'
import { featureDetails, inHa, legalProjectionSurface } from '@/components/Features/index.js'
import { isABLevel, LEVEL_C1, LEVEL_C2, LEVEL_C3 } from '@/referentiels/ab.js'
Expand Down Expand Up @@ -98,6 +99,8 @@ const emit = defineEmits(['submit', 'close'])
const permissions = usePermissions()
const featuresSet = useFeaturesSetsStore()
const showCancelModal = ref(false)
const autofocusedInput = ref()
const { focused } = useFocus(autofocusedInput, { initialValue: true })
const patch = reactive({
NOM: props.feature.properties.NOM || '',
Expand Down

0 comments on commit c2cdef4

Please sign in to comment.