Links must have a clear, valid destination
Rule
- Audit: Accessibility
- Standard:
- Level:
- Success Criteria:
- ID:
unclear-anchor-url
Description
This rule determines if a given anchor element<a> have defined following unclear url:
href="#"href="javascript:"href=""
href attribute should not be used and may be misinterpreted by screen readers, or the action may be unexpected.
How to fix it
- Make sure the attribute
hrefvalue always is a valid URL. - Link with the attribute
href="#"should be disabled. The use of thedisabledattribute is not allowed. It is still possible to disable a link by following 3 steps:- Attribute
hrefmust be removed so that it can no longer receive focus. - Add the
role="link"so the element will always be considered as a link by screen readers. - Add the attribute
aria-disabled="true"so the element is indicated as being disabled.
- Attribute