LogoLogo
  • 🧙‍♂️Dude Coding Standards
  • HTML
    • Accessible HTML Guidelines
      • Blocks
      • Upper title/Prefix
      • Global links
      • Search form
    • HTML elements
      • Lists
      • Headings
  • PHP
    • PHP Guidelines
    • Linting PHP with PHP_CodeSniffer
  • CSS
    • CSS and SCSS Guidelines
      • Naming Conventions
        • Custom properties and variables
        • Naming classes
      • Defining font families
      • Nesting
    • Stylelint
  • SVGs
    • Importing SVG files into a project
    • SVGs and accessibility
    • Styling SVGs
Powered by GitBook
On this page
  • Wrong
  • Right

Was this helpful?

Edit on GitHub
Export as PDF
  1. HTML
  2. Accessible HTML Guidelines

Global links

Wrong

Why it is wrong

In this example we have an empty hyperlink element that is still readable with screen reader devices. It tells the blind nothing so it's a huge accessibility issue. And that's not all, the element is also not browsable via keyboard because its styles fill up the whole column.

<div class="col">
  <a href="<?php echo esc_url( get_the_permalink() ); ?>" class="global-link"></a>
  <h2>Title</h2>
  <p>Descriptive text.</p>
</div>

Right

Why it is right

This example ignores the global link from screen readers and keyboards so that it serves only for seeing users. For assistive devices we use a normal link in title

<div class="col">
  <a href="<?php echo esc_url( get_the_permalink() ); ?>" class="global-link" aria-hidden="true" tabindex="-1"></a>
  <h2>
    <a href="<?php echo esc_url( get_the_permalink() ); ?>">
      Title
    </a>
  </h2>
  <p>Descriptive text.</p>
</div>

Last updated 11 months ago

Was this helpful?

Page cover image