unclear-anchor-url

⌘K
  1. Home
  2. SiteLint
  3. Accessibility Rules
  4. unclear-anchor-url

unclear-anchor-url

Print this article

Description

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 the 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

Was this article helpful to you? No Yes

How can we help?