Make sure to read this post before raising a thread here:
Then tell us:
What language is this for?
html/javascript/Angular
Which rule?
Mouse events should have corresponding keyboard events
Why do you believe it’s a false-positive/false-negative?
The rule excludes standard HTML <button> elements because they inherently support keyboard events (like Enter or Space).
Our Context:
We use Inhouse custom buttons (<sh-button>) instead of native <input type="button"> or <button>. These custom components already handle keyboard accessibility internally, should we need a way to exclude them from the rule as they appear not as 100s of “Bugs”
Are you using
SonarQube Cloud version 2025.5.0
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
We have an item in the backlog, SONARHTML-304, to parameterize this rule to support custom frameworks. In the meantime, you’ll want to mark these issues as FPs or turn off the rule in your Quality Profile.
It’s probably a side effect of the upgrade, and this rule being added to the Sonar Way (Jira)
How are you handling tab(s) + enter for the click on the sh-tab-item?
In my experience this has always been a valid positive. It is better for the custom component to take a click action and bind it to a button internally then to bind it directly to the component. This is because it is significantly easier to make a button not look like a button then it is to make a non button work like a button (keyboard events, tab-index/navigation, cursor pointer consistency, ex.).