WCAG 1.3.1: Info and Relationships (Form Elements)

Back to all WCAG criteria

OVERVIEW

Effort:

  • Complexity:Easy
  • Duration:Fast

Important for:

Developement

What is it about?

Forms must be structured so that their relationships and hierarchy are correctly represented in the code. This includes giving every field a clear, understandable name and marking groups of related fields programmatically as a single unit.

Illustration of a contact form showing an input field for first name. Above it is the field’s label, which is programmatically linked to the input using the HTML for attribute.

How to

Depending on your situation, you can implement one of the following options to meet the criterion. More details can always be found in the linked WCAG techniques.

  • Illustration of a contact form showing a surname input field with a visible label above it. The label is correctly linked to the input using the HTML for attribute.

    Give form fields a name

    Form fields (<input>) do not have a name in the accessibility tree by default. That’s why they need text that is programmatically associated with the input. The recommended way is to use a <label>:

    <label for="firstname">First name:</label> <input id="firstname" name="firstname" type="text">

    However, a <label> is not always possible. In that case, it can be done using aria-label or aria-labelledby.

    This can be the case with a slider: <p>Please select the <span id="slider-label">number of days.</span></p> <div id="mysldr" role="slider" aria-labelledby="slider-label"></div>

    Accessible development?

    Our workshop for developers!

    Learn everything you need to know in our workshop to build accessible websites!

    More about the workshop

    Learn accessibility wiht us?

    Looking to implement WCAG best practices in your design, development, or content workflow? Book a workshop for your team or contact us directly to learn more.

    Get in contact!