Closed
Bug 499969
Opened 17 years ago
Closed 15 years ago
when a text input field has both onchange and onkeypress handlers, they fire incorrectly, then locks page
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: greg3, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11
an input field with both onchange and onkeypress handlers, onchange fire prematurely... for simple character input, it fires with the second character typed; for select-and-replace, it fires immediately.
after the unexpected firing, the page refuses to accept any further input. This is fixed by clicking outside the window (any other application or another window). After that it works fine.
for reference:
- my expectation is that onchange does not fire until I leave the input field.
- the code of my example looks like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript">
function changed() {
alert("onchange fired");
}
function keypressed() {
alert("omkeypress fired");
}
</script>
</head>
<body>
<p> uses onkeypress</p>
<p> <input name="foo" type=text onkeypress="keypressed();"></p>
<p> uses onchange</p>
<p> <input name="bar" type=text onchange="changed()" ></p>
<p> uses both</p>
<p> <input name="test" type=text onchange="changed()" onkeypress="keypressed();"></p>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
1.type any 2 characters in 3rd input field in example
2.
3.
Actual Results:
first character generates onkepress event (as expected)
second character generates onchange (unexpected), followed by onkeypress
entire window then freezes: it will accept no further input
Expected Results:
each types character should generate onkeypress
but on change should not be generated until I leave the text input field
for me this is catastrophic: many many pages are unusable by my viewers
it does not seem to matter what the two handlers do. (in the demo all these do is display an alert; they do not interact with the value of the field
Updated•17 years ago
|
Component: General → Event Handling
Product: Firefox → Core
QA Contact: general → events
Could you try the lastest Firefox 3.5 RC and see if this is still reproducible?
As far as I can tell, I can reproduce this.
Version: unspecified → Trunk
Comment 3•15 years ago
|
||
You should not test this with "alert" because it still focus. If you use "dump", it will work as expected.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•7 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•