fix(FormField): add help to aria-describedby attribute (#3691)

This commit is contained in:
Romain Hamel
2025-03-26 13:47:38 +01:00
committed by GitHub
parent a63047b79a
commit 20c33920d0
3 changed files with 3 additions and 1 deletions

View File

@@ -86,6 +86,7 @@ provide(formFieldInjectionKey, computed(() => ({
errorPattern: props.errorPattern,
hint: props.hint,
description: props.description,
help: props.help,
ariaId
}) as FormFieldInjectedOptions<FormFieldProps>))
</script>

View File

@@ -80,7 +80,7 @@ export function useFormField<T>(props?: Props<T>, opts?: { bind?: boolean, defer
ariaAttrs: computed(() => {
if (!formField?.value) return
const descriptiveAttrs = ['error' as const, 'hint' as const, 'description' as const]
const descriptiveAttrs = ['error' as const, 'hint' as const, 'description' as const, 'help' as const]
.filter(type => formField?.value?.[type])
.map(type => `${formField?.value.ariaId}-${type}`) || []

View File

@@ -84,6 +84,7 @@ export interface FormFieldInjectedOptions<T> {
errorPattern?: RegExp
hint?: string
description?: string
help?: string
ariaId: string
}