Re: JavaScript, Detecting KeyUp or KeyDown KeyCode

  • From: "R. Haynie" <rhaynie@xxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 23 Jul 2009 09:26:38 -0400

Also, I think this is a good chance to use ARIA.  Although I do not know
the tags and settings at this point, but I think making a span visible,
or populating a DIV with text announcing the user has reached the limit
of data entry is best, when compared to popping alerts and such.

My understanding of ARIA is that in your case here, you would have a
region defined for s specific "noise" level.  Let's say that region is
set to noisy, so when that region is updated, the AT (such as JAWS or
NVDA) would automatically read the contents of the region without moving
focus.

-R

Homme, James wrote:
>
> Hi Rick,
>
> I've seen web sites that have a read only edit field below the text
> entry field that contains the character count. That would be nicer for
> the user because so many dialogs wouldn't interrupt them.
>
>  
>
> Jim
>
>  
>
> ----------
>
> Jim Homme
>
> Usability Services
>
> 412-544-1810
>
> james.homme@xxxxxxxxxxxx
>
>  
>
> "You can do anything you want to if you put your mind to it" -- Jim
> Homme Sr.
>
>  
>
> *From:* programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] *On Behalf Of *RicksPlace
> *Sent:* Wednesday, July 22, 2009 1:22 PM
> *To:* programmingblind@xxxxxxxxxxxxx
> *Subject:* Re: JavaScript, Detecting KeyUp or KeyDown KeyCode
>
>  
>
> Hi Jim, good idea. I will use it. I was using the onkeyup but the
> onchange will be more accurate and not trigger execution of the JS for
> non input keys. A second JS will pop up a message if the TextBox is
> clicked with the mouse telling the character count and the max allowed
> or the remaining character count before exceeding the max or
> something. A label will display the information to sighted folks in
> real time while a screen reader user will have to click the TextBox to
> get the numbers but that is not much of a hassle. Finally, I will pop
> up a message to a screen reader user automatically if they exceed the max.
>
> I like your idea though, it will eliminate a problem I was having when
> the textbox was full. The message would pop up but trying to hit
> delete would trigger the onkeyUp or down and not allow the user to
> remove excess characters. Your idea should take care of that one.
>
> I'll give that puppy a try!
>
> Thanks again:
>
> Rick USA
>
>     ----- Original Message -----
>
>     *From:* Homme, James <mailto:james.homme@xxxxxxxxxxxx>
>
>     *To:* programmingblind@xxxxxxxxxxxxx
>     <mailto:programmingblind@xxxxxxxxxxxxx>
>
>     *Sent:* Wednesday, July 22, 2009 12:42 PM
>
>     *Subject:* RE: JavaScript, Detecting KeyUp or KeyDown KeyCode
>
>      
>
>     Hi Rick,
>
>     I have an idea that might work. Use the onchange event and attach
>     it to the text field. In the onchange event function, get the
>     length of the value of the input field and store it in some global
>     variable or do whatever you want with it. The code avoids checking
>     keys altogether, which automatically makes it independent of any
>     browser unless JavaScript is turned off or something.
>
>      
>
>     Jim
>
>      
>
>      
>
>     ----------
>
>     Jim Homme
>
>     Usability Services
>
>     412-544-1810
>
>     james.homme@xxxxxxxxxxxx
>
>      
>
>     "You can do anything you want to if you put your mind to it" --
>     Jim Homme Sr.
>
>      
>
>     *From:* programmingblind-bounce@xxxxxxxxxxxxx
>     [mailto:programmingblind-bounce@xxxxxxxxxxxxx] *On Behalf Of
>     *RicksPlace
>     *Sent:* Wednesday, July 22, 2009 11:13 AM
>     *To:* programmingblind@xxxxxxxxxxxxx
>     *Subject:* JavaScript, Detecting KeyUp or KeyDown KeyCode
>
>      
>
>     Hi: Well, it never ends...
>
>     In my JS routine I want to detect some special key to use as a hot
>     key to pop up an alert box when pressed. Reading up on the topic
>     it seems that various browsers recognize diferent keys for the
>     same key when pressed. Has anyone used Key detection in a
>     JavaScript routine that uses a key that would not normally be used
>     for normal data entry? The fx keys do not generate a KeyPress but
>     I'm not sure about KeyUp and KeyDown in the various browsers. Or,
>     do you have a diferent idea of how to tell a user how many
>     characters they have entered in a TextBox from the client-side?
>
>     A label control would require tabbing out of the TextBox and back
>     in, not smooth and resetting focus to the last character typed in
>     the TextBox might be tricky when tabbing back in, I'm not sure. I
>     have everything working but now need some way to trigger the JS
>     Alert box only on a user request or on exceeding the max length
>     allowed for the TextBox. Any ideas?
>
>     Rick USA
>
>      
>
>     ------------------------------------------------------------------------
>
>     This e-mail and any attachments to it are confidential and are
>     intended solely for use of the individual or entity to whom they
>     are addressed. If you have received this e-mail in error, please
>     notify the sender immediately and then delete it. If you are not
>     the intended recipient, you must not keep, use, disclose, copy or
>     distribute this e-mail without the author's prior permission. The
>     views expressed in this e-mail message do not necessarily
>     represent the views of Highmark Inc., its subsidiaries, or affiliates.
>
>
> ------------------------------------------------------------------------
> This e-mail and any attachments to it are confidential and are
> intended solely for use of the individual or entity to whom they are
> addressed. If you have received this e-mail in error, please notify
> the sender immediately and then delete it. If you are not the intended
> recipient, you must not keep, use, disclose, copy or distribute this
> e-mail without the author's prior permission. The views expressed in
> this e-mail message do not necessarily represent the views of Highmark
> Inc., its subsidiaries, or affiliates.

Other related posts: