Make sure labels are non-empty
In practice it's possible to get into a situation where you have:
<input placeholder>
In my case a third-party lib was adding an empty placeholder to my <input> fields.
Right now we're not erroring in these cases because we just check for presence of the placeholder attribute or <label> parent. We should assert non-emptiness as well.
You can imagine this happening with <label>s too:
<label><input></label>
Yes, there's a <label> parent, but there's functionally no label. That's bad.
For <img alt=""> I think it's a little different as the recommendation for presentation-only images is to use an empty alt, right? Does the same recommendation exist with empty placeholders and <label>s with no text content?
@ewinslow I've tracked this as a bug here: https://www.pivotaltracker.com/s/projects/883176.
It seems to me like this is an edge case that's not critical to address right away, so I have put it at the end of the backlog. What do you think?
Also, you're correct about the alt text. Assigning empty alt text is a way to instruct screen readers to treat an image as presentation-only, whereas leaving it off can allow screen readers to apply heuristics to guess the meaning. I've never heard of assistive tech behaving similarly with labels.
Sounds fine. I have a workaround right now that's simple enough. Will scream if it causes any more pain.
On Fri, Dec 6, 2013 at 4:51 PM, Cameron Cundiff [email protected]:
@ewinslow https://github.com/ewinslow I've tracked this as a bug here: https://www.pivotaltracker.com/s/projects/883176.
It seems to me like this is an edge case that's not critical to address right away, so I have put it at the end of the backlog. What do you think?
Also, you're correct about the alt text. Assigning empty alt text is a way to instruct screen readers to treat an image as presentation-only, whereas leaving it off can allow screen readers to apply heuristics to guess the meaning. I've never heard of assistive tech behaving similarly with labels.
— Reply to this email directly or view it on GitHubhttps://github.com/GoogleChrome/accessibility-developer-tools/issues/75#issuecomment-30042689 .