The visual focus indicator is missing.

Link to The visual focus indicator is missing. copied to clipboard
Rule ID:
focus-indicator-missing
User Impact:
Critical
WCAG:
2.4.7.a

Rule

All focusable elements MUST have a visual focus indicator when in focus.

Focusable elements SHOULD have enhanced visual focus indicator styles.

Background

When a visible keyboard focus indicator is not provided, sighted keyboard users will have no idea which link or control has focus making it extremely difficult, if not impossible, to interact with the content. Browsers provide default focus indicators for natively focusable elements, but these may be very difficult to see depending on the color of the control and the page background. In addition, custom elements often have no visible focus indicator at all. Ideal focus indicators are designed to provide good contrast with links and controls and their backgrounds. Focus indicators with good contrast make it much easier to track focus as a keyboard user navigates through the page.

Code Examples

Good examples:

Visual focus indicator has been enhanced:


    <style>
        a:focus {
          outline: 2px solid #8cc63f;
          background-color: #fdf6e7;
        }
    </style>

Failure examples:

Visual focus indicator has been removed:


    <style>
        a:focus {
          outline: none;
        }
    </style>

How To Fix

Common keyboard focus indicator solutions include:

  1. A 2px box around the focused element
  2. A change in the background color of the focused element
  3. The addition of an icon, such as an arrow, next to a menu item
  4. The addition of a thick line under or next to the focused element
  5. A distinctive change to the text of the component such as making it bold and/or underlined
  6. Use the default browser focus indicator.

NOTE: Since each browser has its own default focus indicator style, check each of the major browsers (Chrome, Firefox, Edge, IE, Safari) to ensure the default focus indicator is visible as you tab through the page.

A keyboard focus indicator can take different forms; it does not have to be a boring box. But the goal is to provide a difference in contrast between a component's default and focused states of at least 3 to 1 or another distinctive visual change.

References