mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-21 07:21:46 +01:00
fix(FormField): resolve minor accessibility and rendering issues (#4515)
Co-authored-by: Romain Hamel <rom.hml@gmail.com>
This commit is contained in:
@@ -89,10 +89,15 @@ export function useFormField<T>(props?: Props<T>, opts?: { bind?: boolean, defer
|
||||
.filter(type => formField?.value?.[type])
|
||||
.map(type => `${formField?.value.ariaId}-${type}`) || []
|
||||
|
||||
return {
|
||||
'aria-describedby': descriptiveAttrs.join(' '),
|
||||
const attrs: Record<string, any> = {
|
||||
'aria-invalid': !!formField?.value.error
|
||||
}
|
||||
|
||||
if (descriptiveAttrs.length > 0) {
|
||||
attrs['aria-describedby'] = descriptiveAttrs.join(' ')
|
||||
}
|
||||
|
||||
return attrs
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user