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

RE: onKeyPress activates link in Opera

From: Jon Hanna <jon@spin.ie>
Date: Fri, 4 Jul 2003 11:55:01 +0100
To: <w3c-wai-ig@w3.org>

> I have created two links and a JavaScript function. To ensure keyboard
> accessibility, I understand that I should use both onClick and onKeyPress.
> These would normally be used to open a popup window, not an alert box.
> <a href="popup.html" onclick="popup('popup.html')">onclick</a>
> <a href="popup.html" onkeypress="popup('popup.html')">onkeypress</a>
> function popup(url){
>   window.open(url, ...);
> }
> In Opera, the onClick event handler is fired by pressing Enter (which
> doesn't make sense, I think). But the onKeyPress activates the link when I
> navigate off it by pressing the A key. The first behaviour suggests that
> onKeyPress is unnecessary. The second, that using onKeyPress
> actually makes
> the page unusable. Internet Explorer seems to ignore the tab key
> press when
> tabbing through the links.
> Am I missing something here? Can I tell people to use onKeyPress as a
> redundant even handler, knowing that it misbehaves in Opera?

First off I'm guessing that the popup function is going to open a new
window. That probably has more accessibility concerns than the rest of this

Secondly onclick doesn't mean "on click" on most browsers
(counter-intuitive, but then it isn't English, it's only English-based). In
order to support keyboard users and other devices apart from mice it means
"on click or otherwise activate this element's default behaviour" - i.e. for
a link it means to either click it or press enter. There isn't any reason to
consider that behaviour as mandated or even compatible with the HTML
standards, but it is the norm, and it's sensible.

Third, is pressing A a normal way of following a link in Opera? IIRC it's
normally used when reading mails to add the sender to the contacts book.
Therefore why would someone press A (and indeed this will be triggered by
most keys) if they want to follow the link.
Received on Friday, 4 July 2003 06:53:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 October 2015 16:21:24 UTC