You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of rendering unexpected FormControl children before the rest of the content, we render them in the same spot we'd normally render a Primer input component
When rendering an input other than a form component from Primer, you must manually pass the attributes that make the form control accessible:
99
+
100
+
- The input should have an ID
101
+
-`FormControl.Label` should be associated with the text input by using `htmlFor`
102
+
- If there is a caption, the input should be associated with the caption by passing the message's ID to `aria-describedby`
103
+
- If there is a validation message, the input should be associated with the message by passing the message's ID to `aria-describedby`
104
+
- If there is both a caption and a validation message, the input should be associated with the message by passing the both the validation message's ID and the caption's ID to `aria-describedby`. Example: `aria-describedby="caption-id validation-id"`
105
+
- If the input's value is invalid, `aria-invalid={true}` should be passed to the input.
106
+
- If the input is disabled, `disabled` should be passed.
107
+
- If the input is required, `required` should be passed.
108
+
109
+
When rendering a custom checkbox or radio component, you must also pass `layout="horizontal"` to the `FormControl` component.
`To correctly render this field with the correct ARIA attributes passed to the input, please pass one of the component from @primer/react as a direct child of the FormControl component: ${expectedInputComponents.reduce(
63
-
(acc,componentName)=>{
64
-
acc+=`\n- ${componentName.displayName}`
65
-
66
-
returnacc
67
-
},
68
-
''
69
-
)}`,
70
-
'If you are using a custom input component, please be sure to follow WCAG guidelines to make your form control accessible.'
0 commit comments