Confirmed on Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b4pre) Gecko/20090310 Shiretoko/3.1b4pre (.NET CLR 3.5.30729) Additional details: removing tabindex="10" from the first input box causes the problem to go away. Also, for some reason, focus only shifts to the submit button the first time that you tab away from the input box in the second form. If you try clicking on the input box in the second form and tabbing away again, focus shifts to the next input box in that form. Refreshing the page "resets" it and will cause focus to shift to the submit button again. This seems to be a bug since the default tabulator order should match the visual sequence of elements (should it not?). I also tested in IE7, Safari 3.2.1, and Opera 9.64 (all on Windows Vista). In those browsers, unlike Firefox, the tabulator order correctly matches the visual sequence. Note to bug submitter: you can include HTML files as attachments.
Created attachment 367100 [details] [diff] [review] Possible patch nsEventStateManager keeps track of the tabindex of the current element (in a variable named mCurrentTabIndex). mCurrentTabIndex is initialized to a default of 0, and it is changed when the user focuses on an element with an explicit tabindex value. The problem happens when the user performs this sequence of actions: 1. The user clicks on an element with an explicit tabindex (e.g. tabindex="10" in the testcase provided above). mCurrentTabIndex changes from the default value of 0 to 10. 2. The user clicks on an element with no explicit tabindex. mCurrentTabIndex does not change. 3. The user presses <tab>. Because mCurrentTabIndex is set to 10, the focus shifts to the element that comes after the element with tabindex=10, as if the element with tabindex=10 was still the current element. The solution is to make sure mCurrentTabIndex gets reset to its default of 0 when the user clicks on an element with no explicit tabindex.
Attachment #367100 - Flags: review?
Thanks for finding a likely solution and patch.
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → 3.1 Branch
Comment on attachment 367100 [details] [diff] [review] Possible patch Smaug, I think you'd be a better person to look at this one.
Attachment #367100 - Flags: review?(jst) → review?(Olli.Pettay)
Comment on attachment 367100 [details] [diff] [review] Possible patch This needs a mochitest. I'll review/superreview after that is done. Some tab test examples http://mxr.mozilla.org/mozilla-central/source/content/events/test/test_bug238987.html?force=1 Especially, remember that tabfocus has different value on OSX than on other platforms.
Attachment #367100 - Flags: review?(Olli.Pettay) → review-
This bug should have been fixed by 178324.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.