* - Buttons - Button Activation Inconsistency

What the issue is

Buttons across a web page that lack consistent activation methods pose a significant barrier to users, especially those relying on assistive technologies or different input methods (e.g., keyboard vs. mouse). If some buttons only activate on a mouse click without a corresponding keyboard event, such as pressing the "Enter" or "Space" key, this can prevent keyboard users from interacting with those elements entirely.  

Further, buttons that  activate on keypress, but not both "Space" and "Enter" may cause confusion. This often happens when buttons are rceated from <code><div></code> tags rather than using the default HTML button elements., or where links are styled to look like buttons (limks work on "Enter" but not "Space").

This inconsistency in button activation methods can cause confusion, frustration, and hinder the ability to perform necessary actions on a website.

Why this is important

Providing consistent and predictable ways for users to activate interactive elements like buttons is crucial for accessibility. This consistency supports various user needs and input methods, ensuring that all users, regardless of how they navigate, can interact with web content efficiently and effectively. Ensuring buttons can be activated by both mouse and keyboard inputs is essential for creating an inclusive web experience that accommodates users with motor disabilities, those who rely on keyboard navigation, and users of assistive technologies.

Who it affects

This issue affects:

  1. Users who rely on keyboard navigation to interact with web content, including those using assistive technologies.
  2. Users with motor disabilities who may have difficulty using a mouse and rely on keyboard navigation for web browsing.
  3. Users who prefer keyboard navigation due to personal preference or situational constraints (e.g., using a laptop with a touchpad).

How to remediate the issue

  1. Ensure that all interactive buttons are focusable and can be activated using both mouse clicks and keyboard inputs such as the "Enter" or "Space" keys.
  2. Use standard HTML <button> elements where possible (i.e. use semantic HTML) as they automatically support both keyboard and mouse activation. If a different element is used (e.g., <div> or <a> with a role="button"), ensure that it is correctly scripted to respond to both click and keyboard events.
  3. Regularly test interactive elements with both mouse and keyboard inputs to verify their functionality and ensure consistency across the site.
  4. Provide clear visual and non-visual indicators (e.g., accessible descriptions) that describe how buttons can be activated.

Guidance on creating accessible buttons that support various activation methods can be found at WCAG Quick Reference on Keyboard Accessible.