Asqatasun v4 - RGAA 3.2016 - 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 <label>
tag when its "id"
attribute corresponds to the "for"
attribute of any <label>
tag.
Business description
Criterion
Test
Description
label
), vérifie-t-il ces conditions ? - Le champ de formulaire possède un attribut
id
; - La valeur de l’attribut
id
est unique ; - La balise
label
possède un attributfor
; - La valeur de l’attribut
for
est égale à la valeur de l’attributid
du 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