Open
Bug 151827
Opened 22 years ago
Updated 2 years ago
Incorrect behavior using onkeydown to capture of keycode is 9 (tab) and change form input focus.
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
NEW
People
(Reporter: adent42, Unassigned)
References
()
Details
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530
BuildID: 2002053012
When trying to capture TAB(9)
with javascript onkeydown to redirect focus
to another form input, mozilla will focus
on the form input FOLLOWING the one specified.
It looks like the javascript code is executed
and THEN TABS's functionality is executed, changing
the field focus twice.
Reproducible: Always
Steps to Reproduce:
1. Go to http://www.stupidstartups.com/tabproblem.html
2. select the first form text field.
3. press tab
Actual Results: The input focus is set to the third form input (rightmost)
rather than the second (middle) as expected.
Expected Results: The input focus should be set to the second box.
Example code:
<html>
<head><title></title>
<script language="JavaScript">
function tabNext (nextfield, evt) {
var keyCode = document.layers ? evt.which : document.all ? evt.keyCode :
evt.keyCode;
if ((keyCode == 13)||(keyCode == 9)) {
nextfield.focus();
return false;
} else {
return true;
}
}
</script>
</head>
<body>
<form name=form>
<input name=confirm1 onkeydown='return tabNext(this.form.confirm2,event);'>
<input name=confirm2 onkeydown='return tabNext(this.form.confirm3,event);'>
<input name=confirm3>
</form>
</body>
</html>
Comment 1•22 years ago
|
||
Browser, not engine ---> Event Handling.
Confirming bug with Mozilla trunk binary 2002061208 WinNT.
There is some timing issue involved.
When we step through the testcase in the Mozilla JS Debugger
(Tools > Web Development > JavaScript Debugger), focus is
successfully given to the second form input.
But if we run the test without the debugger, focus ends
up on the third form input.
Assignee: rogerl → joki
Component: JavaScript Engine → Event Handling
QA Contact: pschwartau → rakeshmishra
Updated•22 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•22 years ago
|
QA Contact: rakeshmishra → trix
Updated•15 years ago
|
Assignee: saari → nobody
QA Contact: ian → events
Updated•8 years ago
|
Summary: Incorrect behavior using onkeydown to capture of keycode is 9 (tab) and chang form input focus. → Incorrect behavior using onkeydown to capture of keycode is 9 (tab) and change form input focus.
Assignee | ||
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
Comment 3•3 years ago
|
||
I am unable to reproduce this using the HTML code in the description.
(The linked URL no longer works.)
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•