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

  1. Make sure the attribute href value always is a valid URL.
  2. Link with the attribute href="#" should be disabled. The use of the disabled attribute is not allowed. It is still possible to disable a link by following 3 steps:
    1. Attribute href must be removed so that it can no longer receive focus.
    2. Add the role="link" so the element will always be considered as a link by screen readers.
    3. Add the attribute aria-disabled="true" so the element is indicated as being disabled.

Standard

Accessibility, SiteLint, Best Practice