org.sonar.l10n.web.rules.Web.MouseEventWithoutKeyboardEquivalentCheck.html Maven / Gradle / Ivy
The newest version!
Offering the same experience with the mouse and the keyboard allow users to pick their preferred device.
Additionally, users of assistive technology will also be able to browse the site even if they cannot use the mouse.
Noncompliant Code Example
<a onClick="doSomething();" ...> <!-- Non-Compliant - 'onKeyPress' missing -->
<a onMouseover="doSomething();" ...> <!-- Non-Compliant - 'onFocus' missing -->
<a onMouseout="doSomething();" ...> <!-- Non-Compliant - 'onBlur' missing -->
Compliant Solution
<a onClick="doSomething();" onKeyPress="doSomething();" ...> <!-- Compliant -->
<a onMouseover="doSomething();" onFocus="doSomething();" ...> <!-- Compliant -->
<a onMouseout="doSomething();" onBlur="doSomething();" ...> <!-- Compliant -->