The ACF link field favours the WCAG violation 2.4.4 "Link has non-empty accessible name"
W
Wanja
We often use the ACF Link Field (https://www.advancedcustomfields.com/resources/link/) in combination with with image elements. Each image is wrapped in a link. We set the Link Field to required but the user can still leave the Link Field blank, which causes an accessibility issue ("Link has non-empty accessible name" – https://www.w3.org/WAI/standards-guidelines/act/rules/c487ae/).
This is what we get:
<a href="{{ link.url }}" aria-label="{{ link.title }}><img /></a>
Users with screenreaders and impaired vision will not be able to understand where the link will take them – when
{{ link.title }}
is empty.We have a simple workaround for that:
In addition to the ACF Link field, we create an ACF Text field (https://www.advancedcustomfields.com/resources/text/). We make that a required field and use the value as the actual link text:
Workaround:
<a href="{{ link.url }}" aria-label="{{ customTextfField }}><img /></a>
This works in the fontend but it is confusing for the editor. The text input "Link Text" in the ACF Link field is now without effect – and they don't know why.
So the idea would be, that you add an optional parameter to the ACF Link field (https://www.advancedcustomfields.com/resources/link/), that allows us to set the text input "Link Text" required – if it is needed. As far as I can tell from the available documentation online (https://www.advancedcustomfields.com/resources/link/), there is no such feature yet.
Thanks in advance!