ANDI icon indicating copy to clipboard operation
ANDI copied to clipboard

Labels not seen by ANDI when an input has the "switch" role

Open Christian-Sibo-ONRR opened this issue 2 years ago • 1 comments

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:

  1. "Switch Element has no accessible name."
  2. "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.

Christian-Sibo-ONRR avatar Mar 09 '22 21:03 Christian-Sibo-ONRR

Thank you for the detailed analysis. This seems like a bug with an easy fix. We will look into fixing this soon.

JohnCotterSSA avatar Mar 10 '22 15:03 JohnCotterSSA