Closed Bug 99349 Opened 23 years ago Closed 23 years ago

keypress event fired too late

Categories

(Core :: DOM: Events, defect)

x86
Windows ME
defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 54035

People

(Reporter: douglas, Assigned: joki)

Details

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90) BuildID: 20010726 The keypress event is fired after the character has been processed and acted upon. It needs to fire first. That way, a script can cause the key to be ignored {e.preventDefault()} or modified {e.charCode = e.charCode.toUpperCase ()}. Reproducible: Always Steps to Reproduce: I attached a keypress handler to an <input> field. d.addEventListener('keypress', keypress, false); function keypress(e) { alert('keypress'); } I type a character. Actual Results: The character is displayed in the input field, and THEN the alert is popped. At this point, the event has arrived too late to allow for any filtering or special handling. Expected Results: The character should appear in the <INPUT> after the alert.
Duplicate of "key handlers set by JS fire *after* character inserted in text field" *** This bug has been marked as a duplicate of 54035 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
yep
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.