onClick event - is it a mouse only event?

It has been suggested in the forums that the onclick event is a mouse only event and is not triggered when tabbing to a link and activating it with the keyboard - is this true?
Date Created: 14th October 2006
Date Modified: 14th October 2006
Home > JavaScript > onclick event

Checking comment made in WebmasterWorld JS Forum:

About the only thing I can offer is that with onmouseover, onclick should be redundant, since one would have to mouseover to click. Still, the onclick event is more reliable than onmouseover, which can fail at times.

Onmouseover and onclick are both mouse events; onfocus would cover the case where a field was tabbed to and the enter key used simulate onclick.

Rambo Tribble

Move to the link below using the keyboard and try activating the link using the keyboard only - does the onclick event fire?

Events fired:
[Link with onclick / onmouseover / onfocus / onkeypress events set]

The onclick event is triggered! It is not just a mouse event in this respect - or maybe the onclick event is simulated for accessibility?

This DIV also has an onclick event assigned, but can you access this with the keyboard? NO... it can't get focus. The onfocus event does not fire either (in FF, but it does in IE6!)

NB: The onfocus event in the above DIV does fire in IE6 (not FF) when the user clicks on it (immediately before the onclick event). The user cannot, however, cause the onfocus event to fire using the keyboard (tab).