You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the HTML5 spec, when a label tag contains a for attribute it must accompany a labelable element of matching id. This is to aid usability of forms in browsers as well as to help screen readers.
The following commit adds a failing test that should hopefully explain what I mean: chy-causer@c4f43e7
I used Mojo::DOM in the test rather than hard-coded the id and for attributes directly because a fully working solution could possibly have to rewrite these attributes. A naive solution of
may well break HTML validation on existing sites whenever multiple fields for name foo are rendered on a page.
It is possible that this is an intractable problem, and if so, may I please request a short note or example in the docs for label_for and rendering guides indicating that when label_for is used, the input field requires its id attribute to match? I was scratching my head for a bit as to why my label tags were not clickable.
Many thanks.
The text was updated successfully, but these errors were encountered:
According to the HTML5 spec, when a label tag contains a
for
attribute it must accompany a labelable element of matchingid
. This is to aid usability of forms in browsers as well as to help screen readers.The following commit adds a failing test that should hopefully explain what I mean:
chy-causer@c4f43e7
I used
Mojo::DOM
in the test rather than hard-coded theid
andfor
attributes directly because a fully working solution could possibly have to rewrite these attributes. A naive solution ofmay well break HTML validation on existing sites whenever multiple fields for name
foo
are rendered on a page.It is possible that this is an intractable problem, and if so, may I please request a short note or example in the docs for
label_for
and rendering guides indicating that whenlabel_for
is used, theinput
field requires itsid
attribute to match? I was scratching my head for a bit as to why my label tags were not clickable.Many thanks.
The text was updated successfully, but these errors were encountered: