Skip to content

Commit

Permalink
Merge pull request #886 from dnum-mi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
laruiss authored Aug 9, 2024
2 parents 36da083 + 155a1e1 commit 2d058af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 20 additions & 1 deletion demo-app/views/AppForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const radioTest = ref('')
<div>
<DsfrRadioButtonSet
v-model="radioTest"
legend="Légende des boutons radio"
legend="Légende des boutons radio dans la prop"
name="radio-123aui"
:options="[
{
Expand All @@ -52,6 +52,25 @@ const radioTest = ref('')
},
]"
/>
<DsfrRadioButtonSet
v-model="radioTest"
name="radio-123aui"
:options="[
{
label: 'label 1',
value: 1,
required: true,
},
{
label: 'label 2',
value: 2,
},
]"
>
<template #legend>
Légende des boutons radio dans le slot
</template>
</DsfrRadioButtonSet>
</div>
<DsfrButton
type="submit"
Expand Down
6 changes: 4 additions & 2 deletions src/components/DsfrRadioButton/DsfrRadioButtonSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const onChange = ($event: string) => {
}
emit('update:modelValue', $event)
}
const ariaLabelledby = computed(() => message.value ? `${props.titleId} messages-${props.titleId}` : props.titleId)
</script>

<template>
Expand All @@ -38,11 +40,11 @@ const onChange = ($event: string) => {
'fr-fieldset--valid': validMessage,
}"
:disabled="disabled"
:aria-labelledby="`${titleId} messages-${titleId}`"
:aria-labelledby="ariaLabelledby"
:role="(errorMessage || validMessage) ? 'group' : undefined"
>
<legend
v-if="legend"
v-if="legend || $slots.legend"
:id="titleId"
class="fr-fieldset__legend fr-fieldset__legend--regular"
>
Expand Down

0 comments on commit 2d058af

Please sign in to comment.