a11y.css
a11y.css copied to clipboard
Labels for form elements that are hidden in a non-accessible way are not flagged as errors
Labels that are associated with a form element via the id, but that have the label itself hidden in a non-accessible way are not highlighted as errors. The following examples should be considered not valid labels:
<label style="display: none" for="test1">label</label>
<input type="text" id="test1" name="test1"/>
<label style="visibility: hidden" for="test1">label</label>
<input type="text" id="test1" name="test1"/>
<label hidden for="test1">label</label>
<input type="text" id="test1" name="test1"/>
An exception to this would be a label that uses the hidden attribute but has its display type overridden by CSS. This should be considered a valid label (the browser will correctly give this input an accessible name in the a11y tree):
<label hidden for="test4" style="display: block">label</label>
<input type="text" id="test4" name="test4"/>
Thanks, these are good ideas! I'll try to see what makes sense, they could be warnings too.
Even an inline style can be overriden with !important so they can't be errors, I guess.