New issue 102177 by wiegert....@gmail.com: Tabindex / focus issue
http://code.google.com/p/chromium/issues/detail?id=102177
ChromeFrame version: 15.0.874.106 (Official Build 107270)
Related URL(s): (internal app...but test page that proved it out attached)
Steps to reproduce the issue:
1. Create a form with multiple fields
2. Programmatically set the tabindex on them from 1...<number of fields>
3. When on the page, hit tab and focus stays on first field
What do you expect to happen?
I expect focus to go from field that has tabindex=1 to field with tabindex=2
What do you see instead?
Focus stays on the tabindex=1 field the first time you hit tab and then
after that its OK.
This sounds trivial, but in my order entry app, it is a complex form what
needed to be setup with explicit tab stops. And users are keying in data in
the first field, hitting tab, beginning to enter data for next field and
overwriting the first field. Very annoying.
Another issue with this: You can start somewhere else on the form
(tabindex=2), and then key in data and hit tab, and then the focus goes
onto the tabindex=1 field. Its as if chrome frame always wants to go to
tabindex=1 first, instead of the next field in the tab sequence
Attachments:
cfTest.html 689 bytes
FYI -
Code was working fine prior to 15.0.874.106 chrome frame auto update.
Works fine in Chrome 15.0.874.106
There is no apparent activity on this ticket. When will this be triaged
and, more importantly, fixed?
The workaround is to use the <body onload=""> event to set the focus,
rather than jQuery. The attached file runs for me on IE8/GCF. Note that I
also added a <form> element.
Attachments:
testtab.html 483 bytes
This is a major blocker for our product as well. Users are sent to a form
element at the top of long forms the first time they press "tab".
It seems to me that there must be a variable for "current tab index" that
is not being updated until the tab key is physically pressed in GCF. Once
the tab key is pressed ONCE, the tab index is handled correctly via the tab
key, via focus events, and via mouse clicks.
If you navigate to a new page, the behavior resets (and the first tab press
always focuses the first element). If you enter a new URL in the address
bar, the behavior also resets. I have been unable to work around the
problem by simulating a tab press by dispatching a KeyboardEvent (it is
very possible I am dispatching the event incorrectly).
However, if the registry key "HandleTopLevelRequests" is set to 0, the GCF
behavior changes slightly. Navigation between links does no longer resets
the behavior. Entering a new URL in the address bar still resets the
behavior. Thus, it seems this behavior occurs any time a "top level
request" is handed off to IE, then back to GCF.
I took a similar approach to blakebis (although much more brute force). My
app was already tracking the id of the last input that had focus, so I had
that id available to me. I added a textbox and styled it didn't have a
border and it blended in to the screen. I gave it the first tabindex and
gave it a focus handler. In the focus handler I had a pretty big
if..then.else block that set checked the last field id that had focus and
then set focus to the next field in line after that. Its probably not %100
accurate, but it works for our purposes. I won't post the code out of fear
of embarrassment, but if anyone wants a snippet let me know :)
I think it will be issues like this that might force us to rethink chrome
frame (had one other issue before a couple of weeks before this). We have
a captive internal audience and can dictate what browsers we want to
support. We may dictate Chrome in the future and abandon IE/GCF.
I've had success by simply setting the first input with a tabindex=-1. W3C
defines negative values for tabindex as follows:
"If the value is a negative integer, the user agent must allow the element
to be focused, but should not allow the element to be reached using
sequential focus navigation.".
In practice, this means GCF will not consider the first input as part of
sequential navigation but, due to its current erratic behavior, it will
consider the next input field -- which is the input itself.