Ids and labels for inputs

Ids and labels for inputs

rrlorentzenrrlorentzen Posts: 1Questions: 0Answers: 0
edited September 2011 in Bug reports
Currently in version 1.8.2 there are no ids on the input boxes. There are also no for attributes in the labels for these inputs. The applications I am using datatables for are required to be accesible according to the standards at http://www.w3.org/WAI/. I can easily modify the source to accommodate for this but when a new release comes out I have to do it again. In a future release it would be nice not to have to do this. Also, having more than one datatable on a page means the ids are not unique so being able to set those ids in the initialization would be helpful.

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    "id" and "for" with inputs and labels is used from explicit linking of the two, but this is not required when the input element is inside the label as this forms an implicit relationship between them (for example load up a DataTable and click on the text "Search:" for the table - the input element will become focused due to this relationship).

    From the HTML spec ( http://www.w3.org/TR/html4/interact/forms.html#h-17.9 ):

    > To associate a label with another control implicitly, the control element must be within the contents of the LABEL element. In this case, the LABEL may only contain one control element. The label itself may be positioned before or after the associated control.

    So in that regard, these elements are already meeting the accessibility guidelines and there should be no need to make any modifications.

    Allan
This discussion has been closed.