Closed Skeeve closed 3 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Seems no one cares or can explain :(
Or nobody agrees with your reasoning.
But i guess considering that there are no links to specific spec sections backing up your reasoning, it could also be that nobody took a closer look.
Okay…
So here's a reference which made me think it's automatic.
https://docs.mojolicious.org/Mojolicious/Plugin/TagHelpers
For fields that failed validation with "validation" in Mojolicious::Plugin::DefaultHelpers the field-with-error class will be automatically added through "tag_with_error", to make styling with CSS easier.
When i say spec, i mean like the HTML5 spec.
What does HTML5 specs to do with this.
You know what…
Maybe it's due to the fact that I'm not a native speaker, but a lot of the Mojolicious Community appears quite arrogant to me. This is not the first case.
I will close the issue now and simply forget about all this.
Bye…
We don't make decisions about HTML semantics arbitrarily, we follow the specs in all our APIs. If you don't like that then that's on you.
Still I do not see where HTML5 is related. It's just about tag helpers and validaton.
@Sheeve because the error behaviour is based on the HTML5 specification.
If you want to make a case for this being a bug, you need to do so based on https://www.w3.org/TR/html52/sec-forms.html
I think it may actually be possible to do so, but you're going to need to understand how HTML5 works to make that argument, and that's not arrogance, that's just "in order to argue for something being a bug, you need to understand what standard the code's implementing". Also reading RFCs is fun :P
https://www.w3.org/TR/html52/sec-forms.html#the-label-element
Example #2 on the page says:
Note that the id attribute is required to associate the for attribute, while the name attribute is required so the value of the input will be submitted as part of the form.
Please also note that in my example #2 the id of the element matches the "for" of the label.
If that doesn't qualify as a bug found, I don't know.
Steps to reproduce the behavior
Please compare the output of this (# 1)
To the output of this (# 2)
and this (# 3)
in case of a validation error on the field.
When
id
eqname
(# 1), label gets the error class:When
id
nename
(# 2), label does not get the error class:When
id
is missing, label gets the error class:Expected behavior
While I understand that the "for" attribute refers to the "id" attribute of the labeled field, I do not understand why
id
andname
have to be identical in order to propagate the class to the label. I expected the label to get the class as well.I also do understand that, in case of the nested input element, there shouldn't be a "for" attribute, but unfortunately the class does not get propagated up to the surrounding label at all.
So what I would expect when there was a validation issue on a field:
Actual behavior
label does not get the error class when there is no "for" attribute or the field's "id" does not match its "name".