Closed
Bug 357156
Opened 18 years ago
Closed 15 years ago
If an alert box has focus and enter is pressed to close it, the keypress is passed down to the text field if onkeyup is overridden
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 112298
People
(Reporter: drew, Unassigned)
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
I have a set of textboxes which all have an onkeyup callback attached to them. If one of the input fields creates a javascript alert box due to an error and the user presses the enter key to make it go away (space bar or clicking works fine) then enter key is passed to the textbox even though the alert has focus, causing unwanted behaviour.
Reproducible: Always
Steps to Reproduce:
1. Create a sample html page with the following code
<html>
<head>
<script type="text/javascript">
function kp(ev)
{
var e = ev ? ev : window.event;
if (e == undefined || e == null) return false;
var keycode = (e.keyCode) ? e.keyCode : e.which;
if (keycode == 13) {
alert("Enter was pressed");
}
}
</script>
</head>
<body onload="document.getElementById('keytest').onkeyup = kp">
<input type="text" id="keytest" size="5" />
</body>
</html>
2. Place focus on the text field, press the enter key. When the alert pops up, press the enter key to make it go away. You will see that it gets called again. If you use spacebar, the textbox does not have a space appended to it.
Actual Results:
The keyup callback gets called when it shouldn't
Expected Results:
Pressing enter should make the alert box disappear and return focus to the textbox, rather than call the onkeyup routine again due to the enter key pressed on the alert box.
Updated•18 years ago
|
Version: unspecified → 2.0 Branch
Comment 1•18 years ago
|
||
Reporter, do you still see this problem with the latest Firefox trunk build? If not, can you please close this bug as WORKSFORME. Thanks!
- http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
Whiteboard: CLOSEME 07/14
Comment 2•17 years ago
|
||
Comment 3•17 years ago
|
||
The testcase does what is described in comment 0 for me in:
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a7pre) Gecko/2007072605 Minefield/3.0a7pre
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.6pre) Gecko/20070724 BonEcho/2.0.0.6pre ID:2007072403
Over to DOM:Events Handling to have a say on what is expected (because I don't know)
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → events
Version: 2.0 Branch → Trunk
Updated•15 years ago
|
Whiteboard: CLOSEME 07/14
Comment 4•15 years ago
|
||
Going by the testcase, this is a duplicate of bug 112298. The summary disagrees with the testcase...
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•