Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Issue 2604303002: (Mac)Views: Widgets focus first View in traversal order if initial focus fails. (Closed)

Created:
3 years, 11 months ago by Patti Lor
Modified:
3 years, 11 months ago
Reviewers:
karandeepb, tapted, sky
CC:
chromium-reviews, tfarina, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

(Mac)Views: Widgets focus first View in traversal order if initial focus fails. views::Widgets use SetInitialFocus(), which calls WidgetDelegate::GetInitiallyFocusedView() to set focus to a View on first opening the Widget. In cases where GetInitiallyFocusedView() returns an unfocusable View, the call to RequestFocus() silently fails and the Widget is opened without focus on anything. In particular, this is happening on MacViews when full keyboard access is turned off. Support for full keyboard access was implemented in r391744, but DialogDelegate::GetInitiallyFocusedView() still returns the dialog's default button regardless of full keyboard access. This results in the dialog opening with nothing focused. Fix this in general for all views::Widgets trying to focus an unfocusable View - if the View returned by WidgetDelegate::GetInitiallyFocusedView() isn't able to become focused and no other View has focus, manually advance focus on the focus manager instead. BUG=657850 TEST=On Mac with #secondary-ui-md flag enabled and full keyboard access turned off (System Preferences > Keyboard > Shortcuts, make sure 'All controls' radio button is not selected), open the collected cookies dialog by going to google.com, clicking 'Secure' on the left of the omnibox, and clicking 'X in use' under 'Cookies'. The TreeView should have focus. Review-Url: https://codereview.chromium.org/2604303002 Cr-Commit-Position: refs/heads/master@{#443827} Committed: https://chromium.googlesource.com/chromium/src/+/7d47709bf1d00beaa556804b25300ebdceecca07

Patch Set 1 #

Patch Set 2 : Use views:: everywhere for consistency (?) #

Total comments: 5

Patch Set 3 : Revert most changes and move fix to Widget::SetInitialFocus() instead. #

Total comments: 4

Patch Set 4 : Add test. #

Total comments: 9

Patch Set 5 : Review comments. #

Patch Set 6 : Fix compile error. #

Total comments: 2

Patch Set 7 : Revert a bunch of changes. #

Total comments: 10

Patch Set 8 : Review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -4 lines) Patch
M ui/views/widget/widget.cc View 1 2 3 4 5 6 7 1 chunk +10 lines, -4 lines 0 comments Download
M ui/views/window/dialog_delegate_unittest.cc View 1 2 3 4 5 6 7 2 chunks +38 lines, -0 lines 0 comments Download

Messages

Total messages: 66 (46 generated)
Patti Lor
Hi Karan, PTAL! Thanks :)
3 years, 11 months ago (2016-12-30 03:48:41 UTC) #8
karandeepb
https://codereview.chromium.org/2604303002/diff/20001/ui/views/controls/focus_ring.cc File ui/views/controls/focus_ring.cc (left): https://codereview.chromium.org/2604303002/diff/20001/ui/views/controls/focus_ring.cc#oldcode39 ui/views/controls/focus_ring.cc:39: DCHECK(parent->HasFocus()); If it's ok, can you send a separate ...
3 years, 11 months ago (2016-12-30 21:16:05 UTC) #9
Patti Lor
Thanks Karan, PTAL. https://codereview.chromium.org/2604303002/diff/20001/ui/views/controls/focus_ring.cc File ui/views/controls/focus_ring.cc (left): https://codereview.chromium.org/2604303002/diff/20001/ui/views/controls/focus_ring.cc#oldcode39 ui/views/controls/focus_ring.cc:39: DCHECK(parent->HasFocus()); On 2016/12/30 21:16:04, karandeepb wrote: ...
3 years, 11 months ago (2017-01-03 03:48:26 UTC) #15
karandeepb
LGTM. But please update the CL description to clarify that this affects all platforms, and ...
3 years, 11 months ago (2017-01-04 00:12:33 UTC) #16
Patti Lor
Hi Trent, are you able to do owner's review for this change? Thanks.
3 years, 11 months ago (2017-01-04 00:39:37 UTC) #19
tapted
This should have a test - something in dialog_delegate_unittest.cc is probably appropriate. https://codereview.chromium.org/2604303002/diff/40001/ui/views/widget/widget.cc File ui/views/widget/widget.cc ...
3 years, 11 months ago (2017-01-04 03:59:38 UTC) #20
Patti Lor
Thanks Trent, PTAL. https://codereview.chromium.org/2604303002/diff/40001/ui/views/widget/widget.cc File ui/views/widget/widget.cc (right): https://codereview.chromium.org/2604303002/diff/40001/ui/views/widget/widget.cc#newcode1316 ui/views/widget/widget.cc:1316: v->RequestFocus(); On 2017/01/04 03:59:38, tapted wrote: ...
3 years, 11 months ago (2017-01-06 06:15:09 UTC) #25
tapted
There's a few subtleties here - please loop in sky when it's ready (I feel ...
3 years, 11 months ago (2017-01-06 11:45:16 UTC) #26
Patti Lor
Hi Trent, PTAL - I'm kind of doubtful about the changes to ViewsTestBase/etc, was this ...
3 years, 11 months ago (2017-01-12 02:16:22 UTC) #35
tapted
https://codereview.chromium.org/2604303002/diff/60001/ui/views/widget/widget.cc File ui/views/widget/widget.cc (right): https://codereview.chromium.org/2604303002/diff/60001/ui/views/widget/widget.cc#newcode1308 ui/views/widget/widget.cc:1308: return false; On 2017/01/12 02:16:22, Patti Lor wrote: > ...
3 years, 11 months ago (2017-01-12 02:25:44 UTC) #36
Patti Lor
https://codereview.chromium.org/2604303002/diff/60001/ui/views/window/dialog_delegate_unittest.cc File ui/views/window/dialog_delegate_unittest.cc (right): https://codereview.chromium.org/2604303002/diff/60001/ui/views/window/dialog_delegate_unittest.cc#newcode289 ui/views/window/dialog_delegate_unittest.cc:289: dialog()->input()->SetFocusBehavior(View::FocusBehavior::NEVER); On 2017/01/12 02:25:43, tapted wrote: > On 2017/01/12 ...
3 years, 11 months ago (2017-01-12 06:12:37 UTC) #43
tapted
lgtm % nits. +sky to ensure the widget.cc changes (and general concept) are sensible https://codereview.chromium.org/2604303002/diff/120001/ui/views/window/dialog_delegate_unittest.cc ...
3 years, 11 months ago (2017-01-12 15:30:51 UTC) #47
sky
General idea SGTM https://codereview.chromium.org/2604303002/diff/120001/ui/views/widget/widget.cc File ui/views/widget/widget.cc (right): https://codereview.chromium.org/2604303002/diff/120001/ui/views/widget/widget.cc#newcode1320 ui/views/widget/widget.cc:1320: if (focus_manager && v != focus_manager->GetFocusedView()) ...
3 years, 11 months ago (2017-01-12 16:34:13 UTC) #48
Patti Lor
Thanks both! https://codereview.chromium.org/2604303002/diff/120001/ui/views/widget/widget.cc File ui/views/widget/widget.cc (right): https://codereview.chromium.org/2604303002/diff/120001/ui/views/widget/widget.cc#newcode1320 ui/views/widget/widget.cc:1320: if (focus_manager && v != focus_manager->GetFocusedView()) On ...
3 years, 11 months ago (2017-01-13 04:19:02 UTC) #52
tapted
lgtm but wait for sky (I'm pretty sure that's what he had in mind though)
3 years, 11 months ago (2017-01-13 19:27:26 UTC) #55
sky
LGTM
3 years, 11 months ago (2017-01-13 20:34:36 UTC) #56
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2604303002/140001
3 years, 11 months ago (2017-01-16 00:07:13 UTC) #59
commit-bot: I haz the power
Internal error: failed to checkout. Please try again.
3 years, 11 months ago (2017-01-16 01:02:35 UTC) #61
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2604303002/140001
3 years, 11 months ago (2017-01-16 01:48:45 UTC) #63
commit-bot: I haz the power
3 years, 11 months ago (2017-01-16 01:54:55 UTC) #66
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as
https://chromium.googlesource.com/chromium/src/+/7d47709bf1d00beaa556804b2530...

Powered by Google App Engine
This is Rietveld 408576698