Bug 46856 - [Chromium] Tabbing into page doesn't always select the first element
Summary: [Chromium] Tabbing into page doesn't always select the first element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-29 16:49 PDT by Avi Drissman
Modified: 2010-10-02 21:02 PDT (History)
2 users (show)

See Also:


Attachments
Patch to fix; modeled after win/WebView.cpp and mac/WebHTMLView.mm (1.34 KB, patch)
2010-09-29 16:57 PDT, Avi Drissman
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Avi Drissman 2010-09-29 16:49:24 PDT
Upstream of http://code.google.com/p/chromium/issues/detail?id=57344 :

What steps will reproduce the problem?
1. Load http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/focus/typical_page.html
2. Click in the omnibox
3. Press [tab] once

Result: search field has focus (correct).

4. Click in the omnibox
5. Press [tab] once

Result: the search button has focus (incorrect).

Every time you tab into a web view, the first element in that view should gain focus (or the last element, if you reverse-tab in).

The bug: in WebViewImpl::setInitialFocus (WebKit/WebKit/chromium/src/WebViewImpl.cpp), just a tab keystroke is fired off. That works the first time when the page is initially loaded since no page object has the focus, but in subsequent calls it just advances the focus (incorrectly).

Compare to WebKit/WebKit/win/WebView.cpp's version which explicitly calls setFocusedNode(0) to reset the focus before advancing using the focus controller.

Broken on all platforms but the Mac (in which this initial focus code is even _more_ broken; see http://code.google.com/p/chromium/issues/detail?id=49738).
Comment 1 Avi Drissman 2010-09-29 16:57:06 PDT
Created attachment 69278 [details]
Patch to fix; modeled after win/WebView.cpp and mac/WebHTMLView.mm
Comment 2 Kenneth Russell 2010-09-29 17:05:35 PDT
Comment on attachment 69278 [details]
Patch to fix; modeled after win/WebView.cpp and mac/WebHTMLView.mm

This looks OK to me based on comparison to mac/WebView/WebHTMLView.mm and win/WebView.cpp.
Comment 3 WebKit Commit Bot 2010-09-30 01:51:10 PDT
Comment on attachment 69278 [details]
Patch to fix; modeled after win/WebView.cpp and mac/WebHTMLView.mm

Clearing flags on attachment: 69278

Committed r68765: <http://trac.webkit.org/changeset/68765>
Comment 4 WebKit Commit Bot 2010-09-30 01:51:15 PDT
All reviewed patches have been landed.  Closing bug.