"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.
For the following markup:
ANDI reports two problems:
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.