Closed Bug 712897 Opened 13 years ago Closed 13 years ago

Since Firefox 9 no keydown event will be fired unless some textbox has the focus

Categories

(Core :: DOM: Events, defect)

9 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 696020

People

(Reporter: Chris78, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20100101 Firefox/9.0 Build ID: 2011121600 Steps to reproduce: Press keyup or keydown on a webpage, while the focus is "on the body" or at least not on any input element. In the body tag I want to trigger a javascript function on "onkeydown", e.g. <body onkeydown="alert('keydown');"> Actual results: The expected onkeydown-event is not fired or at least not propagated to the body element. Expected results: An onkeydown event should be fired and propagated whenever a key is pressed down, even if no input element has the focus. Up to Firefox 8 (including FF8) this was working fine. For example this is useful to... * ...step through certain items on a page by using the arrow keys * ...be able to close overlays etc. using the ESC key
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
This is unfortunate and if there will be new FF9 builds, I'm hoping to get that patch to those builds. But can't promise anything. But, anyway, the key event is fired at window level. you can use window.onkeydown = ....
I'm sorry but I don't understand if the problem has been solved or not... Is there a way to use the standard JS method body.onkeydown with FF9? Thank you.
@MiNiX: This Bug is a duplicate of bug 696020. Have a look there. The issue is fixed but will be released with Firefox 10. So, you'll probably have to wait a few weeks.
Thanks you very much for the information Chris78. I can't wait for the next release! Kind regards.
I've found a temporary workaround for FF9 by adding (!) the onkeydown="process_key(event);" to the <html> tag. I've left the same in the <body> tag, on FF8 (for example) this'll still fire only one event.
@pgmin00: yes, it works and the event fires, but it doesn't work properly if you have to manage other clicks and keypresses in the page.
pmin00 I don't know how you found that the HTML tag processes an event, but that's brilliant. Andrew
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: