Closed Bug 941764 Opened 12 years ago Closed 10 years ago

onkeypress suddenly doesn't work in a class that has worked for 4 years

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

25 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: kentozier, Unassigned)

Details

(Keywords: regressionwindow-wanted)

Attachments

(1 file)

3.20 KB, application/x-javascript
Details
Attached file NFirefoxKeyObserver.js —
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1 Steps to reproduce: Added console.log in event handler to report key events and then type any character key Actual results: keyDown and keyUp events are logged, but keyPress never gets called Expected results: document.onkeypress should call my handler. I wrote this class about 4 years ago and it has worked perfectly for years, up until about Nov 10, 2013. Only thing I can think of is that one of the automatic FF upgrades changed the default key event target from "body" to something that doesn't always respond.
What keys are you trying? Probably things like "Enter", which stopped working in FF 29. If that's the case you're code is just wrong. You cannot expect the onkeypress event for any key. I just had the same problem with some legacy code. The author probably intended to catch onkeydown instead. Unfortunately I could not find the exact change in FF 29 for reference. Can anybody point me to it?
Found some reference. Seems to not have happened on purpose on is going to be reverted: https://bugzilla.mozilla.org/show_bug.cgi?id=1008244
What does the CancelEvent() do? If it calls .preventDefault(), it must be the cause. Now, a call of preventDefault() of keydown event cancels following keypress event(s). This change is for conforming DOM Level 3 Events. By this change, Gecko's behavior is more similar to other browsers. keypress event is now deprecated event in D3E spec. However, it is defined as one of default actions of keydown event. And a call of preventDefault() should cause canceling its default action. https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-keydown http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-Event-preventDefault
Flags: needinfo?(kentozier)
I've sent a note to Ken to follow-up on the pending needinfo request.
Masayuki-san, is this bug actionable as-is or should we close it out as incomplete due to lack of a testcase?
Flags: needinfo?(masayuki)
(In reply to Ryan VanderMeulen [:RyanVM] from comment #5) > Masayuki-san, is this bug actionable as-is or should we close it out as > incomplete due to lack of a testcase? I guess that the cause of calling preventDefault() of keydown via CancelEvent() in the attached js file. If so, the testcase is invalid. I think that we should mark this as INCOMPLETE and if we're wrong, just reopen this bug.
Flags: needinfo?(masayuki)
Thanks for the reply. Ken, if you happen to come back to this bug and find that there's still an issue, feel free to reopen it. Preferably including a reduced testcase that reliably demonstrates the issue.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(kentozier)
Resolution: --- → INCOMPLETE
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: