W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > July to September 2003

Re: onKeyPress activates link in Opera

From: David Woolley <david@djwhome.demon.co.uk>
Date: Fri, 4 Jul 2003 21:56:33 +0100 (BST)
Message-Id: <200307042056.h64KuXw10614@djwhome.demon.co.uk>
To: w3c-wai-ig@w3.org

> These would normally be used to open a popup window, not an alert box.

Which, as the dominant browser doesn't allow popups to be disabled,
causes compliance problems in itself.
 
> <a href="popup.html" onclick="popup('popup.html')">onclick</a>

I believe you meant "return popup('....')....", with popup returning
false if the window.open succeeds and true if it fails.  You need to
return false to avoid the origin windows shifting to the new URL, and
you need to make it conditional on the window.open to stand any chance
of working in Mozilla with popups disabled.  Life's much easier if
you let the user control the browser!

> <a href="popup.html" onkeypress="popup('popup.html')">onkeypress</a>

The real problem with these events is that they were designed for Netscape,
and assuming normal Windows mouse oriented operation, not for the web.  
onkeypress is a rather low level function, only really useful if 
you look at the parameter giving the identity of the key pressed, and
know the key bindings for the browser.  It is not specified in version 
1.0 of the W3C Events Document Object Model, and onclick has the same
specification as in the HTML specification, in terms of the button on
the pointing device.  To strictly comply, without knowledge of the browser,
the browser needs to be in a keypad emulates pointing device mode.

I'm tempted to say that the only pragmatic way of using these is to use
onclick without looking at its parameters.

Note, as far as I can remember, you can write the onkeypress code so
as to invoke the onclick function (although the current object will
be different if you don't do this within the actual definition).

Also, for me, all this code will do is popup a scripting warning, which
I will cancel.

> the page unusable. Internet Explorer seems to ignore the tab key press when
> tabbing through the links.

That's probably technically correct, as it probably actions the tab on
the keydown event, not the keypress event, so the keyup occurs outside
of the object and no keypress event is generated.
Received on Saturday, 5 July 2003 04:42:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 July 2011 18:14:10 GMT