Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-1092

Links should not directly target images

    XMLWordPrintable

    Details

    • Message:
      Change this link to not directly target an image.
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Default Quality Profiles:
      Sonar way
    • Legacy Key:
      LinkToImageCheck
    • Covered Languages:
      HTML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      15min

      Description

      Whenever a user clicks on a link that targets an image, the website's navigation menu will be lost.
      From a user point of view, it is as if she left the website.
      The only way to return to it is using the browser's 'Back' button.
      Instead, it is better to create a page which will display the image using the <img> tag and preserve the navigation menu.

      Further, in terms of accessibility, when the image is embedded into a page, content providers are able to provide an alternate text equivalent through the alt attribute.

      Noncompliant Code Example

      <a href="image.png">...</a>  <!-- Non-Compliant -->
      

      Compliant Solution

      <a href="page.html">...</a>  <!-- Compliant -->
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              freddy.mallet Freddy Mallet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: