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

RESOLVED DUPLICATE of bug 696020

Status

()

Core
DOM: Events
RESOLVED DUPLICATE of bug 696020
7 years ago
7 years ago

People

(Reporter: Chris78, Unassigned)

Tracking

9 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 583749 [details]
Example HTML-file to reproduce the issue

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

Updated

7 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 696020

Comment 2

7 years ago
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 = ....

Comment 3

7 years ago
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.
(Reporter)

Comment 4

7 years ago
@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.

Comment 5

7 years ago
Thanks you very much for the information Chris78.
I can't wait for the next release!
Kind regards.

Comment 6

7 years ago
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.

Comment 7

7 years ago
@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.

Comment 8

7 years ago
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.