Picto thématique

Rule n° 67 - Each Form Field has its own Label associated with it in the Source Code.

Not knowing what is a form field can be extremely confusing.

#Forms #Development #Accessibility

Goal

  • Facilitate the understanding of the data expected in forms.
  • Allow technical accessibility aids to render the fields in forms by systematically attaching a label to them, indicating their role and the nature of the expected input.
  • Simplify input by allowing users to select the field by clicking on either its label or the field itself (especially in the case of a checkbox or a radio button).
  • Improve the accessibility of content for people with disabilities.

Implementation

Give each form field a label explicitly associated with it:

  • if the label is visible, in the form of a label element with a for attribute taking the value of the id attribute given to the field, for example:

<label for="nom1">Family name:</label>

<input id="nom1" type="text" name="nom">

  • if the display of the image is not required (placeholder), in the form of an aria-label ou aria-labelledby.

The use of a <label for="…"> label hidden by CSS styles is not recommended or aria-label ou aria-labelledby.

Control

For each form field:

  • Check, by looking at the source code or using Firebug, that the forattribute, specific to the label element, as well as the id attribute of the field have exactly the same content. If the values of these two attributes are identical, the (label) label is indeed associated with the (input) field.
  • If no label is visible in the site (placeholder), check that each form field has an aria-label or aria-labelledby attribute.

In both cases, finally check that the label effectively describes the role of the field or the nature of the information that must be entered there. So this best practice cannot be automated but requires that each form is manually reviewed

By Opquast - Read the license

Business application and benefits

The rules should be applied to your projects from the design phase through to post-implementation , and they should be understood by all professionals with web and customer experience (CX) responsibilities: from strategy to operations, marketers to project managers, and editorial to technical staff. The benefits of using this ruleset are numerous, including improving customer satisfaction, web performance, and e-commerce, and expanding your client base, while also decreasing your errors and costs.

Multidisciplinary verticles - accessiiblity, SEO, e-commerce, ecodesign etc..- starting from the foundational Opquast base.

The objective of these rules and the Opquast community mission is ‘making the web better’ for your customers and for everyone! Opquast rules cover the key major areas of risk that can negatively affect website users such as privacy, ecodesign, accessibility and security.

Opquast training has already allowed over 11,000 web professionals to have their skills certified. Train your teams or your students, contact us