ANDI
ANDI copied to clipboard
Labels not seen by ANDI when an input has the "switch" role
For the following markup:
<input type="checkbox" role="switch" id="my-switch" aria-checked="false" aria-disabled="false" value>
<label for="my-switch">My Label</label>
ANDI reports two problems:
- "Switch Element has no accessible name."
- "Explicit <label[for]> only works with form elements."
If you change the input's role to "checkbox", the errors go away.
I believe this is a false-positive due to ANDI not properly assigning the label to the input. No other accessibility tool is reporting this as a problem and I don't see any restriction in the HTML spec to say that role="switch"
is not considered a form element.
Thank you for the detailed analysis. This seems like a bug with an easy fix. We will look into fixing this soon.