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

Unified Diff: ui/views/widget/widget.cc

Issue 2684403002: Views: Don't advance focus in Widgets when the stored focus view is not null. (Closed)
Patch Set: Check Widget active state instead of StoredFocusView. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/window/dialog_delegate_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 6063a224684cb38ec980a29621197060167065c1..719ff108106512c4c2f262b61ad3136f41ffadeb 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -1305,10 +1305,13 @@ bool Widget::SetInitialFocus(ui::WindowShowState show_state) {
}
if (v) {
v->RequestFocus();
- // If the request for focus was unsuccessful, fall back to using the first
+ // If the Widget is active (thus allowing its child Views to receive focus),
+ // but the request for focus was unsuccessful, fall back to using the first
// focusable View instead.
- if (focus_manager && focus_manager->GetFocusedView() == nullptr)
+ if (focus_manager && focus_manager->GetFocusedView() == nullptr &&
+ IsActive()) {
focus_manager->AdvanceFocus(false);
+ }
}
return !!focus_manager->GetFocusedView();
}
« no previous file with comments | « no previous file | ui/views/window/dialog_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698