RE: onclick and onkeypress scripting technique issue

IE has such an action, at least for click.  I haven't tried mouseover,
but MSDN (http://msdn.microsoft.com) should have documentation on which
events can be fired this way.  If memory serves, this worked all the way
back to IE4.

<span tabindex="1" onclick="alert('click');"
onkeypress="this.click();">hot span</span>

Paste this into an HTML page, tab till the "hot span" has focus, and hit
a key.  You'll see the 'click' alert.

-----Original Message-----
From: Charles McCathieNevile [mailto:charles@w3.org] 
Sent: Wednesday, April 17, 2002 9:13 AM
To: Phill Jenkins
Cc: w3c-wai-gl@w3.org
Subject: Re: onclick and onkeypress scripting technique issue


Hi Phill,

yes, there is a new issue to deal with here, at the same time as dealing
with a legacy issue - IE has linked some events, but not all of them,
other developers have implemented the spec as is, and the result is that
it is hard for authors.

My initial thoughts are that it would be useful if IE had a deliberate
"fire the mouse" action that could be keyboard generated, or if the
specifications were written to unify the mouse and keyboard models, but
having an unspecified half-way solution is not serving us in the long
term. On the other hand, it should be acknowledged that they have helped
some people in the short term.

I recommend that people interested in this question consider the PF
working group as a venue for further discussion - there are several
groups working on event models including HTML, and SVG. I realise the
member-only nature of that group means people will have to join it and
agree to the confidentiality requirements, but consider that the work
there is valuable.

cheers

Charles McCN

On Wed, 17 Apr 2002, Phill Jenkins wrote:

  >To: HTML techniques editors
  >
  >In the WCAG HTML techniques [1] about making scripts directly
accessible,
  >it says to <quote> provide redundant input mechanisms. In other
words,
  >specify two handlers for the same element such as "onclick" with
  >"onkeypress" <endquote>.  This practice seems to be causing problems
  >because the IE 5.5 browser (for example) sends two events to the
server
  >when using the keyboard, but only one event when using the mouse.  IE
maps
  >the keyboard to some mouse events, such as allowing the user to tab
to the
  >form controls and pressing the enter key instead of using the mouse
to
  >trigger the event, so the second onkeypress event is not necessary.
  >
  >1. Is it IE that has a bug?  What about Netscape, Opera, Lynx, etc
  >2. What about the assumption of the User Agents capability and other
  >software standards?
  >
  >508 and UAAG all require the ability to do with the keyboard what can
be
  >done with the mouse.  IE and other browsers should allow the user to
  access
  >the controls with only the keyboard.  Techniques and standards should
not
  >require or put burden on the content author that causes problems,
  >especially when the burden should and is being handled by the user
agent.
  >Why add on keypress when the device or agent is capable of the
mapping?
  >
  >So, what is a web developer to do?  Following the techniques causes
  >problems.
  >
  >The technique seems to have been established in Feb 1999, or at least
that
  >is when the issue [2] was raised and resolved.  But, in my opinion,
  >resolved incorrectly with today's browser capabilities and today's
UAAG
  >standard [3].  In other words, a new issue should be logged.
  >
  >[1] Directly Accessible Scripts
  >http://www.w3.org/TR/WCAG10-HTML-TECHS/#directly-accessible-scripts
  >[2] Device independent
  >http://www.w3.org/WAI/GL/wai-gl-tech-issues.html#dd-events
  >[3] UAAG requirement
 
>http://www.w3.org/TR/2001/CR-UAAG10-20010912/guidelines.html#gl-device-
independence

Received on Wednesday, 17 April 2002 12:39:26 UTC