That, however is a workaround: if the element has no appropriate role, it’s guesswork for users (that’s why we have 4.1.2 Name, Role, Value). And it also fails 2.1.1 Keyboard.
In any of those cases, use a <button> element and it will fix both issues. They are focusable, and activating them with the keyboard conveniently also fires a click event.