Rule 11.1.2
Summary
This test consists in checking the presence and the unicity of the "id" attribute of each form field associated with a <label> tag. We assume here that a form field is associated with a "
Business description
Criterion
Test
Description
Chaque champ de formulaire, associé à une étiquette (balise label), vérifie-t-il ces conditions ?
- Le champ de formulaire possède un attribut
id - La valeur de l'attribut
idest unique - La balise
labelpossède un attributfor - La valeur de l'attribut
forest égale à la valeur de l'attributiddu champ de formulaire associé
Level
A
Technical description
Scope
Page
Decision level
Decidable
Algorithm
Selection
Set1 (input form fields)
All the <input> tags within a <form> tag with a "type" attribute equals to:
- "text"
- or "password"
- or "checkbox"
- or "radio"
- or "file"
- or "search"
- or "tel"
- or "email"
- or "number"
- or "url"
- or "date"
- or "range"
- or "color"
- or "time"
AND all the <textarea>, <select>, <datalist>, <keygen> tags AND for all of them no "aria-label", "aria-labelledby" or "title" attribute.
Set2
All the <label> tags within a <form> tag
Set3
All the element of Set1 with no <label> tag as parent.
Set4
All the element of Set2 with an <input> child with an "id" attribute.
Process
Tests
Test1
For each element of Set1, test if the node contains a not empty "id" attribute.
For each occurence of false-result of Test1, raise a MessageA.
Test2
For each element of Set1 with an "id" attribute, test that this id is unique on the page.
For each occurence of false-result of Test2, raise a MessageB.
Test3
For each element of Set2, test if this element has a not empty "for" attribute.
For each occurence of false-result of Test3, raise a MessageC.
Test4
For each element in Set3, test if the "id" attribute is equals to the "for" attribute of a <label> in the same