Closed 34N0 closed 1 year ago
Hm. Can this also be achieved with the for
attribute?
AFAIK the for
is used to explicitally define the relationship between the elements and is used by the html5 validation and some js validation libraries. It might be that some accessibility tools like screen readers use the field as a fall back if aria-labelledby
is not set.
But setting the aria-labelledby
is general best practice.
Okay. It's implemented in version 3.4.8. I put aria-hidden on honeypot-input too. Thanks for you support. Send me a pm for your free license as thanks for your improvement.
Hey!
As of now the aria-labelledby (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) attribute is not added to the fields.
I implemented the proof of concept like this:
Add the attribute to the field:
snippets/blocks/formfields/input.php:
And then add the id to the label:
snippets/blocks/formtemplates/fields.php:
To fully support it should be added to the hidden field as well which could be achieved by using the function:
The clean implementation would probably be in the
ariaAttr()
function in the FormField class.What do you think? How would you like it to be implemented? I would be open to contribute by creating a pr :smile: