If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Conflict between javascript changing field focus and using tab

RESOLVED WORKSFORME

Status

()

Core
Layout: Form Controls
RESOLVED WORKSFORME
15 years ago
14 years ago

People

(Reporter: jsado, Assigned: John Keiser (jkeiser))

Tracking

Trunk
Sun
SunOS
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
I have created a form in which certian fields are of a known length. Using
Javascript and setting a callback function on the onkeypress event, I can
determine if the text in the field has reached the length, and then have the
text cursor automatically go to the next field. In my form these "autotab"
fields are intersperced with regular fields that require the user to hit the tab
key in order to change focus to the next field.

The first field (CDE Tag) is a four character field. The next three are variable
length. HRID is a seven character field, building is a two character field,
floor is a one character field. Room is a variable length field.

The expected results are: Click into the CDE Tag field and type 4 characters.
The cursor automatically goes down to the next field. Type something in this
field and press tab. Do the same for the next two fields. Type 7 characters into
the HRID field. The cursor automatically goes down to the next field. Type two
characters into the building field. The cursor goes to the next field. Type one
character into the floor field. The cursor goes to the room field. Type
something into the room field and hit tab. The cursor goes to the phone field.

Actual results: The cursor at the end of it all, instead of going to the phone
field as I expect, it goes to the building field. This leads me to believe that
mozilla registers a difference between the user hitting the tab key to move to
another field, and programatically changing the focus. The HRID field was the
last field that I had used the tab to get to, so the next time I use the tab, I
get to the building field, regardless of where I am (unless I change focus using
the mouse to click into a field).

It seems to me, that hitting the tab key should take the user to the next field
relative to where they are at (taking the tabindex attribute into account, of
course), not the next field that they haven't tabbed into.

I have tested this on Mozilla 1.0 under SunOS 5.8, and Mozilla 1.0 and 1.0.1
under PC Linux.

I have also tried this out on Netscape 4.x and IE 5.x and they both produce the
expected result (that is tabbing from the Room field takes you to phone, not
building)

I will attach the html with embedded javascript.
(Reporter)

Comment 1

15 years ago
Created attachment 100896 [details]
html file that demonstrates the bug.

Comment 2

15 years ago
Let me reassign this to Form Controls for a look, although perhaps
this is for Event Handling (?)

However, on WinNT anyway, the testcase worksforme using the above
steps to reproduce, using Mozilla trunk binary 20020926xx.
Following the steps given above, I end up in the phone field,
not the building field -
Assignee: rogerl → jkeiser
Component: JavaScript Engine → HTML Form Controls
QA Contact: pschwartau → tpreston
(Reporter)

Comment 3

15 years ago
I just tried this out on a recent build of Mozilla and it does work correctly.
So the problem is just stuck in the 1.0.x releases.

Comment 4

14 years ago
wfm and reporter, closing
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.