Trên trang này

Trang này chưa có bản tiếng Việt, nội dung bên dưới là bản tiếng Anh. Xem trang tiếng Anh

Trường

What Field gives you and what your team does.

Conformance

Field meets WCAG 2.2 level AA when used as described on these pages. It adds structure; the controls inside bring their own keyboard support.

What Field gives you

  • role="group" on each field, and a native <fieldset> with <legend> for FieldSet, so a group of checkboxes or radios has a name.
  • FieldLabel is a native <label>.
  • FieldError has role="alert": when it appears, screen readers read it.
  • Labels in color.text, help text in color.text.subtle, errors in color.text.danger.

What your team does

  • Set for on the label and id on the control.
  • Link help text and the error with aria-describedby on the control, and set aria-invalid="true" on an error.
  • Use FieldSet and FieldLegend for a group of checkboxes or radios.
  • Write errors that say how to fix the problem. Show them after people leave the field or submit, not while they type the first character.

WCAG criteria

Criterion Level How
1.3.1 Info and Relationships A <label>, <fieldset>, <legend>, aria-describedby
3.3.1 Error Identification A Error in words, linked to the control
3.3.2 Labels or Instructions A Label and help text
3.3.3 Error Suggestion AA The message says how to fix it
4.1.3 Status Messages AA role="alert" on the error