Re: [WSG] onKeyPress or not onKeyPress

2006-05-10 Thread Jon Tan

Derek Featherstone wrote:

On 5/9/06, Jan Brasna wrote:

early builds of Safari on Jaguar might have exhibited a failure 
to execute onclick with the keyboard.
I remember something similar, be it an old Safari or some wacky 
Netscape, don't really know. I'd say it's not an active issue anymore.


Jan - agreed, wholeheartedly. However, if we can pinpoint user agent
compliance and/or non-compliance, we can make a much better case for
ignoring some of the outdated guidelines.


Using Safari with user-agent string:

Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.b(KHTML, 
like Gecko)Safari/312.6


No event is triggered by tabbing to a link with the onkeypress paired 
with an onclick event handler in Al's test page. Behavior consistent 
with that expected of an onblur event occurs. For example in Al's test 
page when 'test this link' loses focus, the content is revealed /not/, 
as should be the case, when a key is pressed with the link having focus.


[Mac OSX 10.2.9 / Safari 1.3.2(v312.6)]

-Jon



**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Patrick H. Lauke

Katrina wrote:

I am currently reading a book called 'DOM Scripting' by Jeremy Keith. In 
it, the author suggests not to use onKeyPress as it can lead to 
accessibility issues when users are tabbing past those elements with 
that eventHandler.


But at the same time it remains recommended to add both.

HTML Techniques for Web Content Accessibility Guidelines 1.0
http://www.w3.org/TR/WCAG10-HTML-TECHS/#directly-accessible-scripts.


The problem is that onkeypress is not a direct equivalent of onclick. 
The proper, device independent handler would be onactivate (which, if I 
remember correctly, is part of the DOM events, but not part of the HTML 
spec and only supported in IE, of all browsers).



Suggests that tabbing through may cause accessibility issues
http://webstandardsgroup.org/manage/archive.cfm?uid=BAC0AC1F-FFCB-6022-5ECD34D2CF16F906 


Yup, that's correct. In principle, it seems right that even hitting TAB 
should trigger an onkeypress...it's a key, after all; however, this 
cause issues as noted.


Suggests writing a function that tests for TABbing because Mac browsers 
don't treat onClick in a device independent way.
http://webstandardsgroup.org/manage/archive.cfm?uid=BAC115E5-AA7E-1E4F-82E6DE89F699ED80 


Safari does indeed seem to be the only current web browser which doesn't 
generate an onclick event via the keyboard - anything else treats a 
keyboard activation (e.g. hitting enter when the focus is on a link, for 
instance) as onclick.


 Is the recommendation to use onKeyPress and testing for certain keys
 to prevent the TAB activating some onKeyPress code?

So, to accommodate Safari, you should consider using a custom function 
that only gets triggered if the user has hit enter etc (i.e. not 
indiscriminately firing for every keypress).


Another technique (if you're applying this to links) could be to 
programmatically change the href to a javascript pseduo-protocol via the 
DOM on page load...this will then be fired when the link is activated, 
no matter how (mouse, keyboard, etc). Purists will frown at this 
(although I myself frown at the need to write our own event handler, 
just because Safari doesn't follow the de-facto standard...even Netscape 
4 triggers onclick via the keyboard, if I remember correctly...so why 
not Safari?)


P
--
Patrick H. Lauke
__
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
www.splintered.co.uk | www.photographia.co.uk
http://redux.deviantart.com
__
Web Standards Project (WaSP) Accessibility Task Force
http://webstandards.org/
__
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Al Sparber

From: Katrina [EMAIL PROTECTED]
I am currently reading a book called 'DOM Scripting' by Jeremy 
Keith. In it, the author suggests not to use onKeyPress as it can 
lead to accessibility issues when users are tabbing past those 
elements with that eventHandler.


I would (and do) avoid onKeyPress. Most people I observe using it, do 
so because they have onclick events embedded and when they run the 
page through an automated accessibility checker it throws an error :-) 
As you've gathered, onkeypress wreaks havoc with people's expectations 
when using the tab key. In 99% of the browsers on the market, the 
Enter key will fire an onclick. In some modern browsers, onkeypress 
will prevent the Enter key from behaving as one would expect it.


--
Al Sparber
PVII
http://www.projectseven.com

Designing with CSS is sometimes like barreling down a crumbling 
mountain road at 90 miles per hour secure in the knowledge that 
repairs are scheduled for next Tuesday.





**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Derek Featherstone
On 5/9/06, Patrick H. Lauke wrote:

Safari does indeed seem to be the only current web browser which
doesn't generate an onclick event via the keyboard - anything else
treats a keyboard activation (e.g. hitting enter when the focus is on
a link, for instance) as onclick.

Patrick - I just want to clarify this piece of information here. Is
there a specific version of Safari that does this, or do you have
documented test cases? I've got scripts that respond without fail to the
onclick in Safari, so I'd like to try and delve a little deeper.

I'm running the latest version of Safari 2.0.3

Cheers,
Derek.
-- 
Derek Featherstone   [EMAIL PROTECTED]
tel: 613-599-9784  1-866-932-4878 (toll-free in North America)
Web Development: http://www.furtherahead.com
Personal:http://www.boxofchocolates.ca
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Patrick H. Lauke

Quoting Derek Featherstone [EMAIL PROTECTED]:


Patrick - I just want to clarify this piece of information here. Is
there a specific version of Safari that does this, or do you have
documented test cases? I've got scripts that respond without fail to the
onclick in Safari, so I'd like to try and delve a little deeper.

I'm running the latest version of Safari 2.0.3


Sorry, my reply was based on a bit of research that I never got around to
collating properly carried out over a year ago. It's well possible that
more current versions of Saf finally fire onclick even following keyboard
activation, which then makes this point fairly moot (unless you need to
support older versions of Safari, of course)

Will fire up my BrowserCam remote access and double-triple-check tonight.

P
--
Patrick H. Lauke
__
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
www.splintered.co.uk | www.photographia.co.uk
http://redux.deviantart.com
__
Web Standards Project (WaSP) Accessibility Task Force
http://webstandards.org/
__

**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Al Sparber

From: Derek Featherstone [EMAIL PROTECTED]

Test this page for yourself:
http://www.projectseven.com/testing/keypress/

--
Al Sparber
PVII
http://www.projectseven.com

Designing with CSS is sometimes like barreling down a crumbling 
mountain road at 90 miles per hour secure in the knowledge that 
repairs are scheduled for next Tuesday.





**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Al Sparber

From: Derek Featherstone [EMAIL PROTECTED]

Test this page for yourself:
http://www.projectseven.com/testing/keypress/



Thanks for the test case, Al... that wasn't my point though. I was
looking for documented cases where Safari didn't work with onclick. 
I
*know* that it works just fine with my current version of Safari. 
I'm

looking for history that shows where it didn't in the past.


Ah. We upgraded all of our Macs to Panther and Tiger, but, if memory 
serves, early builds of Safari on Jaguar might have exhibited a 
failure to execute onclick with the keyboard. 



**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Jan Brasna
early builds of Safari on Jaguar might have exhibited a failure 
to execute onclick with the keyboard.


I remember something similar, be it an old Safari or some wacky 
Netscape, don't really know. I'd say it's not an active issue anymore.


--
Jan Brasna :: www.alphanumeric.cz | www.janbrasna.com | www.wdnews.net
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] onKeyPress or not onKeyPress

2006-05-09 Thread Derek Featherstone
On 5/9/06, Jan Brasna wrote:

 early builds of Safari on Jaguar might have exhibited a failure 
 to execute onclick with the keyboard.

I remember something similar, be it an old Safari or some wacky 
Netscape, don't really know. I'd say it's not an active issue anymore.

Jan - agreed, wholeheartedly. However, if we can pinpoint user agent
compliance and/or non-compliance, we can make a much better case for
ignoring some of the outdated guidelines.

Cheers,
Derek.
-- 
Derek Featherstone   [EMAIL PROTECTED]
tel: 613-599-9784  1-866-932-4878 (toll-free in North America)
Web Development: http://www.furtherahead.com
Personal:http://www.boxofchocolates.ca
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list  getting help
**



[WSG] onKeyPress or not onKeyPress

2006-05-08 Thread Katrina

Gday,

I am currently reading a book called 'DOM Scripting' by Jeremy Keith. In 
it, the author suggests not to use onKeyPress as it can lead to 
accessibility issues when users are tabbing past those elements with 
that eventHandler.


But at the same time it remains recommended to add both.

HTML Techniques for Web Content Accessibility Guidelines 1.0
http://www.w3.org/TR/WCAG10-HTML-TECHS/#directly-accessible-scripts.


(I am having a hard time trying to resolve both.)


But going through list archives, I find that certain posts

Suggests that tabbing through may cause accessibility issues
http://webstandardsgroup.org/manage/archive.cfm?uid=BAC0AC1F-FFCB-6022-5ECD34D2CF16F906

Suggests writing a function that tests for TABbing because Mac browsers 
don't treat onClick in a device independent way.

http://webstandardsgroup.org/manage/archive.cfm?uid=BAC115E5-AA7E-1E4F-82E6DE89F699ED80

Suggests using onKeyPress
http://webstandardsgroup.org/manage/archive.cfm?uid=F40C2D16-D963-2946-32B3E0B81A16ADCA


As Dan Cederholm writes, there are decisions, and better decisions. I 
would like to make an informed decision about the uses and consequences 
of these event handlers.



Is the recommendation to use onKeyPress and testing for certain keys to 
prevent the TAB activating some onKeyPress code?


Kat
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**