Hacker News new | past | comments | ask | show | jobs | submit login

To my knowledge this is incorrect. Assistive technologies don't recognize input names when nested inside of label elements, and as a result is frowned upon by the W3C. Unless you meant something else by, "...HTML has always allowed nesting an <input> inside <label>..."

Source: http://www.w3.org/TR/WCAG20-TECHS/F68.html




The results on that page puzzle me for the nested input/label case - this is news to me. Given how browsers already forward focus for clicks on a label to the nested input, I always assumed that this takes care of programmatic association between label and input.

Maybe an aria-labelledby attribute would fix this? Heck, could still use a label "for" attribute and keep the input nested.

Either way, I meant that it is legal HTML to do that kind of nesting. Did not know that it was frowned upon, as far as standards are concerned, even assistive.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: