I'm a web developer having a weird UX issue. When I build HTML forms, I ensure that every input's label is implemented through a
<label></label> tag and that each label uses the
for attribute to associate it with the input. For example:
<label for="firstName">First Name</label> <input id="firstName" type="text" /> <label for="lastName">Last Name</label> <input id="lastName" type="text" />
This follows what I've always heard is an accessibility best practice. It also has what I consider an added benefit of focusing the input when the label is clicked.
Others here disagree on that last point.
They actually say that it's weird that clicking the label focuses the input, and that it's "non-standard" behavior. Since I'm using what I consider standard HTML practices, I would think that is is indeed standard. Perhaps this is just their reaction to the fact that other pages in the site doesn't use real labels and don't have this behavior, but they seem to genuinely hate this label behavior.
I don't understand. Am I in the wrong here? Is it considered bad UX practice to have labels focus an input? If so, why? If I need to fix this, is there an alternate way to make an input more accessible without using a label?