Open edfrias opened 1 year ago
might be related:
Hey @vhoyer ! Thanks for the reply!
I've been reviewing all those issues and I don't feel any of those are related with what I'am describing, even though form-control-has-label
might seems to be close.
The thing is, Oruga UI's o-switch component already creates a label whose have inside a proper labelled-by
aria if you provide it as a prop. Which solves any accessibility issues as it creates a nesting label and then add a proper id
to an element you provide through a slot.
By looking at the rules, form-control-has-label
does not checks for any input type "checkbox" which is my specific case, but also neither rules, form-control-has-label
nor label-has-for
, are checking the resulting input having a correct id that should be matching the same string as the for
value located in the label tag.
I don't know if I'm explaining myself right, but I'm going to try to create a PR in order to let you see which is the case.
Hi everyone,
First of all thanks for creating this tool, it really helps too much!
I recently came to an issue about how labels should control the addition of id/for to the combo of label-input.
So, right now the rule only checks if the input is nested inside a label, or if a label has a
for
attribute but not if the input component has indeed the correctid
.Here is how I define the configuration inside eslintrc:
So you could have a properly created label without an
id
on the following input like so:Also the rule complains if the
id
is set but not thefor
:So my guest is that the validate function shouldn't only been looking for the
for
attribute on labels, but also should be looking for the same string inside thefor
into the input'sid
that is nested or following the label node.I'm based on how W3C tells us how to define properly our form components.