E-mail List Archives
onClick and onKeypress
From: R Sengers
Date: Oct 4, 2005 8:40AM
- Next message: Alex Bovey: "Re: onClick and onKeypress"
- Previous message: Christian Heilmann: "Re: onClick and onKeypress"
- Next message in Thread: Alex Bovey: "Re: onClick and onKeypress"
- Previous message in Thread: None
- View all messages in this Thread
We're working on a site that needs to be Section 508-compliant. We have a link that has a onclick event on it. (We also provide an alternative for users who do not have JavaScript enabled.) Someone told us we need to add a second, redundant onkeypress event to the onclick event (both would do the same thing), to make it more accessible. Is this correct?
W3C's WCAG guidelines says you should use onClick with onKeypress. The US government's guidelines and tips (at access-board.gov) do not mention the onKeypress event. For onClick, they say "it works well with screen readers."
I understand there are some possible issues with onKeypress:
It means that pressing any alphanumeric key will invoke the event, not just the Enter key. Which might be unexpected behavior, for someone who expects only the Enter key have an effect on the link.
Also, having an onClick and an onKeypress event may sometimes cause the event to be fired twice.
Can you tell me any other pros and cons for adding a redundant onKeypress event?
Thanks
Rachel Sengers
- Next message: Alex Bovey: "Re: onClick and onKeypress"
- Previous message: Christian Heilmann: "Re: onClick and onKeypress"
- Next message in Thread: Alex Bovey: "Re: onClick and onKeypress"
- Previous message in Thread: None
- View all messages in this Thread