- Issue created by @jwilson3
- Merge request !170Issue #3526885 by jwilson3: Fix orphaned form label a11y error β (Open) created by jwilson3
- πΊπΈUnited States smustgrave
just tested this out and this doesn't link the hidden inputs to the label. What if you have multiple? Example name="field_bef_letters_value[b]"
- πͺπ¨Ecuador jwilson3
Good points.
Needs exploration to determine how the ID attribute is set and passed into the form-element-label.html.twig. and also pass it into bef-links.html.twig.
The only other idea I can come up with is to change the #type to fieldset, in order to style a fieldset legend instead of having a stray label.
- πΊπΈUnited States smustgrave
Wonβt lie Iβm trying to under the purpose of the label
- πͺπ¨Ecuador jwilson3
The only thing I can think of is that the label element is displayed here for visually consistent styling when this element appears alongside other exposed filter elements that *do* rely on the form element label.
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
I don't think it makes sense to have a
label
for aninput
that is hidden.ARIA could be used to associate this label with what it is labelling. It would still not be a
label
element. - πͺπ¨Ecuador jwilson3
I don't think it makes sense to have a label for an input that is hidden.
I totally agree with you. And my prior suggestion to convert to a fieldset w/ legend was rooted in this thinking. But a fieldset that only contains a hidden form element with a list of links also makes no sense semantically.
Semantically, the only thing I can think of that makes sense here is a
<nav>
wrapper with a span or div tag around the label. Of course, at that point we would lose the default Drupal form element label styling, which makes this issue somewhat of a breaking change.And sadly this is why I ended up with the current workaround to just add the id attribute to the hidden input.