Skip to main content

Links & buttons

Clickable element cannot be used with the keyboard

WCAG 2.2 success criterion 2.1.1 Keyboard (Level A)

WCAG 2.2
2.1.1 Keyboard
Level
A
Default severity
Needs review
Available in
Free

Updated for Lumtera 1.3.0 and Lumtera Pro 1.2.0.

Why does it matter?

WCAG 2.1.1 asks that everything works from a keyboard; this element has a click handler but cannot take focus and contains nothing that can, so keyboard users cannot trigger it. It is fine if the same action is available another way on the page.

Who it affects: Screen reader users who browse by a list of links, keyboard users, and people using voice control who say a link's words to click it.

What does Lumtera flag?

An element with an inline click handler that cannot take focus and contains nothing that can. For review: it is fine if the same action is available another way on the page.

Check ID click-not-focusable — use it to filter the content report or with wp lumtera issues --rule.

How do I fix it in WordPress?

Use a real <button> (or <a href> if it goes to another page), which works with the keyboard and screen readers out of the box. If you must keep this element, add role="button" and tabindex="0", and make Enter and Space do what a click does.

Example

Flagged
<div onclick="openCart()">Cart</div>
Fixed
<button type="button" onclick="openCart()">Cart</button>

How do I check the fix?

  1. Update the post. The issue disappears from the Lumtera Accessibility sidebar on the next check, and from the site report on the next scan.
  2. Press Tab through the page. Every link and button should receive visible focus, and its text should make sense read on its own.

Find this issue across your whole site

Lumtera runs this check in the block editor sidebar as you write, in the Elementor panel, in Review mode on the live page, and across the whole site in the content report and with wp lumtera scan. You can change its severity or turn it off in Lumtera → Settings.

All checks

Start with the free plugin today

All 88 content checks and 38 whole-page checks, fixes you approve with undo, and the site report — free, with no account and no page limits.