
org.sonar.l10n.web.rules.Web.MouseEventWithoutKeyboardEquivalentCheck.html Maven / Gradle / Ivy
Offering the same experience with the mouse and the keyboard allow users to pick their preferred devices.
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();" ...> <!-- Noncompliant - 'onKeyPress' missing -->
<a onMouseover="doSomething();" ...> <!-- Noncompliant - 'onFocus' missing -->
<a onMouseout="doSomething();" ...> <!-- Noncompliant - 'onBlur' missing -->
Compliant Solution
<a onClick="doSomething();" onKeyPress="doSomething();" ...> <!-- Compliant -->
<a onMouseover="doSomething();" onFocus="doSomething();" ...> <!-- Compliant -->
<a onMouseout="doSomething();" onBlur="doSomething();" ...> <!-- Compliant -->
© 2015 - 2025 Weber Informatics LLC | Privacy Policy