Button events - how to tell difference between mouse click and pressing enter

I would agree this is an antipattern, but you can prevent the default behavior of the browser by:

  1. Adding an onKeyDown handler
  2. Checking the 'Prevent Default' box in the options

From there, clicking the button will send onClick but pressing enter or spacebar will not.