Question

Does a button with a value really need a matching label tag in order to be 508 compliant?

Say I have:

<label for="search_box" class="hideme">search query</label>
<input type="text" id="search_box">
<input type="button" id="search" value="Search">

The web accessibility testing software is flagging it since it has an id but no matching label? Is it really necessary?

Was it helpful?

Solution

A <label> is not needed for <input type="button">, you need to provide a value attribute. If the button is using an image versus text, you need to provide an alt to be compliant.

<input type="button" src="....jpg" alt="Search" id="...">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top