Bug 12517

Summary: REGRESSION: Tab order incorrect when input inside frame/iframe gets initial focus
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: KwhiteRight
Priority: P1 Keywords: EasyFix, HasReduction, InRadar, Regression
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Test focus (no frames; works as expected)
none
Test frame focus (does not work as expected)
none
Test iframe focus (does not work as expected)
none
Patch with ChangeLog and test darin: review+

Description David Kilzer (:ddkilzer) 2007-01-31 16:46:16 PST
Summary:

When an <input> element inside a <frame> or an <iframe> gets the initial focus on the page, the tabbing order is incorrect.

Steps to reproduce #1:

1. Open Safari/WebKit.
2. Open one of the two attached test cases.
3. Hit Tab.

Expected results #1:

Next <input> element should be focused.

Actual results #1:

Either "nothing" happens (focus does not change), or focus changes to address bar.

Steps to reproduce #2:

4. Hit Cmd-R (or the Reload button in Safari).
5. Hit Tab again.

Expected results #2:

Next <input> element should be focused.

Actual results #2:

Focus changes to address bar.  Further tabs to to the Google search, then back to the initially focused <input> element again, then finally to the second <input> element.

Regression:

This is a regression from shipping Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037).

Tested with a locally-built debug build of WebKit r19315 with afari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037).
Comment 1 David Kilzer (:ddkilzer) 2007-01-31 16:47:45 PST
Created attachment 12840 [details]
Test focus (no frames; works as expected)
Comment 2 David Kilzer (:ddkilzer) 2007-01-31 16:48:28 PST
Created attachment 12841 [details]
Test frame focus (does not work as expected)
Comment 3 David Kilzer (:ddkilzer) 2007-01-31 16:48:58 PST
Created attachment 12842 [details]
Test iframe focus (does not work as expected)
Comment 4 Mark Rowe (bdash) 2007-02-01 18:43:19 PST
<rdar://problem/4971227>
Comment 5 Adam Roben (:aroben) 2007-02-07 01:52:33 PST
With the frame test it takes me 3 tab presses to move focus from the first <input> to the second.

With the iframe test it takes me 2 tab presses to move focus from the first <input> to the second.

In both test cases, Shift-Tab first moves focus to the second <input>, then back to the first, and focus moves correctly from then on.
Comment 6 Adam Roben (:aroben) 2007-02-07 02:03:58 PST
I suspect that the cause for this is HTMLInputElement::focus is not resulting in the focused frame getting set correctly. Should be a pretty simple fix.
Comment 7 Adam Roben (:aroben) 2007-02-14 18:19:48 PST
Created attachment 13177 [details]
Patch with ChangeLog and test
Comment 8 Darin Adler 2007-02-14 18:38:53 PST
Comment on attachment 13177 [details]
Patch with ChangeLog and test

r=me
Comment 9 Adam Roben (:aroben) 2007-02-14 19:28:43 PST
Landed as r19636