Recently I found out about “MouseEventWithoutKeyboardEquivalentCheck” rule.
It triggers when node
(hasClickEvent || hasRoleButton) && !hasKeyPressEvent
I understand the requirement that asks you to add KeyPress event when OnClick exists. But I don’t understand why KeyPress event is required when button has “role=button”. Having this role set requires as to use native js event, because Sonar ignores jquery, knockout and other libraries.
In our case we already have Click and keyUp event set, but Sonar complains since he can’t notice it.
Similar to MouseOver and MouseOut rules, we shouldn’t take care of “role=button”
I would propose another check for this rule:
hasClickEvent && !hasPressEvent