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

Unified Diff: ui/views/window/dialog_client_view.cc

Issue 2807653002: Ensure default dialog button focus remains after a dialog update. (Closed)
Patch Set: Update DialogClientView to track if a default button focus exists and ensure it remains after dialo… Created 3 years, 8 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
Index: ui/views/window/dialog_client_view.cc
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index 5d543a7572efe2b85b8772f293c766cbdb19430f..c84d6a77b3ae3f8855f1a10c590eae20b36083fb 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -319,6 +319,7 @@ void DialogClientView::SetupLayout() {
base::AutoReset<bool> auto_reset(&adding_or_removing_views_, true);
GridLayout* layout = new GridLayout(button_row_container_);
layout->set_minimum_size(minimum_size_);
+ default_focus_ = GetDialogDelegate()->GetInitiallyFocusedView();
// Clobber any existing LayoutManager since it has weak references to child
// Views which may be removed by SetupViews().
@@ -399,6 +400,10 @@ void DialogClientView::SetupLayout() {
column_set->LinkColumnSizes(link[0], link[1], link[2], -1);
}
layout->AddPaddingRow(kFixed, insets.bottom());
+
+ if (default_focus_) {
+ default_focus_->RequestFocus();
Devlin 2017/04/12 19:36:31 Maybe add a comment why we need to do this.
Ackerman 2017/04/28 18:22:59 Done.
+ }
}
void DialogClientView::SetupViews() {

Powered by Google App Engine
This is Rietveld 408576698