Re: onclick behaviour also triggered by keyboard ?

On Fri, 12 Mar 2004, P.H.Lauke wrote:

> A nice Friday afternoon (at least where I am) question for the list:
>
> although the HTML4.1 specification states that onclick "occurs when
> the pointing device button is clicked over an element" (see
> http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.3 ), in my -
> admittedly limited - testing I have found that it's also triggered by
> keyboard in the usual way in most (if not all) browsers

Yes, of course.  To do otherwise would be to cripple mouse-free browsing.

> So, my question would be: as there's contention as to what the
> device-independent handler equivalent to onclick is (as onkeypress just
> seems to be too generic in that it will be triggered by any key...and
> also would seem like complementing a device-specific handler with yet
> another device-specific one...what about things like voice activation
> in this context ?)...what's the deal ?

The deal is merely that the word "click" triggers a Pavlovian response
in some zealots, blinding them to the observation in your first
paragraph.  So it gets labelled as device-dependent.  In an environment
where consensus is an issue, that leads inevitably to muddle and
confusion.

> Is onclick simply a misnomer, and it should be handled as if it was
> something like "onactivation"

Exactly.

Though calling it a misnomer is perhaps unduly pedantic.  Click is
after all the "expected" event, and the others are just obvious
substitutes.

There are genuine device-dependence issues in scripting events.
But the naming of onclick() isn't one of them.

-- 
Nick Kew

Received on Friday, 12 March 2004 19:10:51 UTC