oscarotero / form-manager

PHP library to create and validate html forms
MIT License
153 stars 42 forks source link

Improve accessibility of error labels #54

Closed cmoralesweb closed 9 years ago

cmoralesweb commented 9 years ago

Error messages are displayed using a label, which is correct per spec, but can cause accessibility issues.

Accessibility can be improved following the last suggestion here http://www.html5accessibility.com/tests/mulitple-labels.html

<label id="l1" for="f3">label text </label> 
<input type="text" id="f3" aria-labelledby="l1 l2"> 
<p>other content</p> 
<label id="l2">more label text</label>

In brief, using aria-labelledby referencing the 2 IDs of the 2 labels.

oscarotero commented 9 years ago

Released in 4.4.0 :smile: