Closed Bug 279609 Opened 20 years ago Closed 19 years ago

No way for page to disable audio cue when browser does not recognize shortcut

Categories

(Firefox :: Keyboard Navigation, enhancement)

x86
Windows XP
enhancement
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: rliu, Assigned: aaronlev)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

There seems to be an audio cue when a hot key does not exist. However, I'm
writing  an browser based application that requires many hot keys by catch the
onkeyup event. Is there any way to disable the audio cue without having to turn
off the volume coming from the PC? 

Thanks in advance.

Reproducible: Always

Steps to Reproduce:
1. Press ALT + (Any key not currently marked as hot key with in browser)
2.
3.

Actual Results:  
My Javascript performs correctly. I was wondering if there's a way NOT to have
the  audio cue even though the hot key does not exist in Firefox. 

Expected Results:  
I would like the option to turn off the audio cue for unmarked hot key actions. 

I love everything else about Firefox. The application we're building is a
browser based application (http://resolution.net).
Not a security bug.

This appears to be normal windows behavior seen in many other programs including IE.
Group: security
Any reason why onkeyup?

I recommend onkeydown, because:
1) It's early enough to prevent the default action of the event from occurring
(which is causing the beep).
2) It also works like that in IE.

Note that unfortunately cancelling the default action of the keydown only works
in nightly builds of Firefox:
http://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-trunk/
If you want this to work with 1.0 you probably need to handle onkeypress for
Mozilla and onkeydown for IE (IE only generates onkeypress for ascii keys).

If you return true from the event handler, it means you are consuming the event
and thus cancelling the default action.

For example:

onkeydown="return event.keyCode != 13 || doSomething();"

More docs here (although I think the checkbox example is out-dated):
http://www.mozilla.org/access/keyboard/tabindex

Does that help? I'm 90% sure it will work, but haven't tried it with ALT+ keys.

No response from reporter, marking WFM.  Please reopen if Aaron's suggested fix
doesn't work for you.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
Summary: Audio Cue when hot key does not exist → No way for page to disable audio cue when browser does not recognize shortcut
You need to log in before you can comment on or make changes to this bug.