Unclear url on the link
Description
Rule ID: unclear-anchor-url
This rule determines if a given anchor element <a>
have defined following unclear url:
href="#"
href="javascript:"
href=""
The incorrect URL defined in an anchor 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
href
value always is a valid URL. - Link with the attribute
href="#"
should be disabled. The use of thedisabled
attribute is not allowed. It is still possible to disable a link by following 3 steps:- Attribute
href
must 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
Standard
Accessibility, SiteLint, Best Practice