RE: [WSG] keyboard onclick activation on Mac

2005-09-22 Thread Patrick H. Lauke

Quoting Webmaster [EMAIL PROTECTED]:


My concern is that the Enter key is also the default key to submit forms. An
onKeypress event could be trigger by most any other key, preferably the
spacebar. Although, as we know, this key also has the function of making
selections in radio groups and select boxes.


Ah...d'oh! I was just thinking about links. You're right, if you have, say,
onclick on an input, then you should filter out Enter (or, even better, check
for it in the handler and, if pressed, submit the form programmatically).
Having said that, it would probably be best not to have onclick on inputs in
the first place, and opting for onfocus instead. Depends on the situation, I
guess...

Thanks for clarifying, I thought I had missed an episode there ;)

--
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] keyboard onclick activation on Mac

2005-09-21 Thread Golding, Antony

Hi Grant,

Try adding the 'onclick' code into an 'onkeypress' entry also...

a href=# onclick=if(!window.print){alert('Your browser does not support 
this feature.Please select print from the file 
menu')}else{window.print()};return false; 
onkeypress=if(!window.print){alert('Your browser does not support this 
feature.Please select print from the file menu')}else{window.print()};return 
false;Print/a

It's a bit of duplication but should hopefully cover both clicks and key 
presses.

Antony Golding
Principal e-Government Services Officer

Salford City Council
E-mail: [EMAIL PROTECTED]
Telephone: 0161-793 2232

I am running the New York City Marathon 2005 on 6th November in aid of Cancer 
Research UK.
Please visit my web site for more information and how to to sponsor me for this 
worthy cause.
http://www.antonyonline.co.uk


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Focas, Grant
Sent: 21 September 2005 06:35
To: wsg@webstandardsgroup.org
Subject: [WSG] keyboard onclick activation on Mac


Hi,
Can anyone enlighten me about keyboard onclick activation problems on Mac?
I have found problems when I have a link such as this:
a href=# onclick=if(!window.print){alert('Your browser does not support 
this feature.Please select print from the file 
menu')}else{window.print()};return false;Print/a

Mac IE 5.2 - can tab to the link but pressing return does nothing
Mac IE5.1 - can tab to the link but pressing return does nothing
Safari 1.0.3 - cannot even tab to the links
Safari 2.0 - works
Netscape 6.2 - works
Netscape 7.0 - works
Netscape 7.2 - cannot even tab to the links
Firefox 1.0.6 - works

On Windows all browsers I have tested work fine.

*
thanks in advance!
Grant

DISCLAIMER: The information in this message is confidential and may be legally 
privileged. It is intended solely for the addressee. Access to this message by 
anyone else is unauthorised. If you are not the intended recipient, any 
disclosure, copying, or distribution of the message, or any action or omission 
taken by you in reliance on it, is prohibited and may be unlawful.  As a public 
body, Salford City Council may be required to disclose this email [or any 
response to it] under the Freedom of Information Act 2000, unless the 
information in it is covered by one of the exemptions in the Act.  Please 
immediately contact the sender if you have received this message in error.  For 
the full disclaimer please access http://www.salford.gov.uk/e-mail.  Thank you.
**
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] keyboard onclick activation on Mac

2005-09-21 Thread Patrick Lauke
 Golding, Antony

 Try adding the 'onclick' code into an 'onkeypress' entry also...

However, in Firefox - and, if I recall correctly, Mozilla (Seamonkey) as
well - a tab also counts as a keypress. Therefore, simply tabbing to the
link and attempting to tab to the next one will trigger the onkeypress
event. In this case, the user starts tabbing, and all of a sudden the
print dialog comes up...

Patrick
__
Patrick H. Lauke
Webmaster / University of Salford
http://www.salford.ac.uk
__
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] keyboard onclick activation on Mac

2005-09-21 Thread Patrick H. Lauke

Webmaster wrote:


You would have thought someone would either exclude the TAB key from
keypress events


Well, to play devil's advocate: TAB *is* a key, so why shouldn't it 
trigger an onkeypress?



(and other keys like Enter, Alt, arrows etc)


I don't think you want to exclude ENTER, as otherwise you can't activate 
the onkeypress via the keyboard in the same way as onclick at all.



This is one aspect of meeting accessibility requirements that I find quite
painful.


The main problem is that, in this instance, the W3C have got it wrong. 
They did not specify a device independent equivalent. onmouseover has 
onfocus, onmouseout has onblur, onclick has...nothing in the HTML spec. 
The device independent equivalent would be onactivate, which is actually 
a DOM event (but the onactivate attribute is invalid, and only supported 
- in a weird proprietary twist - in IE).


It has been common practice for browsers to treat onclick as if it were 
device independent, and fire the event even when a link (and some other 
elements that can take focus) is activated. Unfortunately, Mac browsers 
haven't followed this practice, taking the interpretation of onclick 
literally.



The easy answer, of course, is to avoid Javascript events altogether.


Or, if you must, and your audience does include Mac users, write your 
own little javascript filter function to ignore TAB before activating 
whatever behaviour is in the onclick.


--
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] keyboard onclick activation on Mac

2005-09-21 Thread Webmaster
Patrick H. Lauke quoth:

 Or, if you must, and your audience does include Mac users, write your own
 little javascript filter function to ignore TAB before activating whatever
 behaviour is in the onclick.

And indeed one for the Enter key.

I guess the point I was trying ot make is that these keys already had
specific amnd well understood functions well before the Internet infected
the ether.

It shouldn't have been a leap of thought to reserve them for exclusive
functions. As you say, the W3C got it wrong. Nuff said.

**
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] keyboard onclick activation on Mac

2005-09-21 Thread Patrick H. Lauke

Webmaster wrote:


Or, if you must, and your audience does include Mac users, write your own
little javascript filter function to ignore TAB before activating whatever
behaviour is in the onclick.



And indeed one for the Enter key.


But Enter *is* the keyboard equivalent of the mouse click, so no you 
should not filter it...or am I missing something here?


--
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] keyboard onclick activation on Mac

2005-09-21 Thread Focas, Grant
Thanks for the help,
My solution has been to change:
a href=# onclick=if(!window.print){alert('Your browser does not
support this feature.Please select print from the file
menu')}else{window.print()};return false;Print/a

to this:

HTML:
a href=# onclick=printPage(); onkeypress=return
handleEnter(event); class=topNavPrint/a

JAVASCRIPT:
function handleEnter(ev) {
var ENTER_KEY=13;
var keyCode = ev.keyCode ? ev.keyCode : ev.which ? ev.which :
ev.charCode;
if (keyCode == ENTER_KEY) {
printPage();
return false;   
}
}

function printPage(){
window.print?window.print(): alert('Sorry, your browser does not
support this feature. Please choose print from the file menu.');
}

This now works in Mac IE5.0,5.1,5.2 but Safari 1.0.3 and Mac Netscape
7.2 still do not even allow keyboard tabbing.

Grant

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Webmaster
Sent: Thursday, 22 September 2005 9:49 AM
To: wsg@webstandardsgroup.org
Subject: RE: [WSG] keyboard onclick activation on Mac


Patrick H. Lauke quoth:

 Or, if you must, and your audience does include Mac users, write your
own
 little javascript filter function to ignore TAB before activating
whatever
 behaviour is in the onclick.

And indeed one for the Enter key.

I guess the point I was trying ot make is that these keys already had
specific amnd well understood functions well before the Internet
infected
the ether.

It shouldn't have been a leap of thought to reserve them for exclusive
functions. As you say, the W3C got it wrong. Nuff said.

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

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

**
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**
**
The discussion list for  http://webstandardsgroup.org/

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