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

Unified Diff: chrome/browser/ui/views/find_bar_view.cc

Issue 1660273003: Keep focus on Find-In-Page buttons when using the keyboard to navigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: chrome/browser/ui/views/find_bar_view.cc
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index dbfa65b73c2a8a65e1b298f11b74a490232cf401..91ed00a92c249c4a702896dbd84b8d22a39b5514 100644
--- a/chrome/browser/ui/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -152,6 +152,7 @@ FindBarView::FindBarView(FindBarHost* host)
close_button_ = new views::ImageButton(this);
}
+ find_previous_button_->set_id(VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON);
find_previous_button_->set_tag(FIND_PREVIOUS_TAG);
msw 2016/02/03 19:58:02 nit: remove FIND_PREVIOUS_TAG and FIND_NEXT_TAG, u
Mario Pistrich 2016/02/03 20:41:59 Done.
find_previous_button_->SetFocusable(true);
find_previous_button_->set_request_focus_on_press(false);
@@ -161,6 +162,7 @@ FindBarView::FindBarView(FindBarHost* host)
l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS));
AddChildView(find_previous_button_);
+ find_next_button_->set_id(VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON);
find_next_button_->set_tag(FIND_NEXT_TAG);
find_next_button_->SetFocusable(true);
find_next_button_->set_request_focus_on_press(false);
@@ -432,8 +434,11 @@ void FindBarView::ButtonPressed(
sender->tag() == FIND_NEXT_TAG,
false); // Not case sensitive.
}
- // Move focus to the find textfield.
- find_text_->RequestFocus();
+
+ if (event.IsMouseEvent()) {
+ // Move focus to the find textfield.
+ find_text_->RequestFocus();
+ }
break;
case CLOSE_TAG:
find_bar_host()->GetFindBarController()->EndFindSession(
@@ -601,7 +606,9 @@ void FindBarView::Find(const base::string16& search_text) {
}
void FindBarView::UpdateMatchCountAppearance(bool no_match) {
- bool enable_buttons = !match_count_text_->text().empty() && !no_match;
+ // Enable the buttons if there is a match or if there is a match count text
+ // set (from a prepopulated view).
+ bool enable_buttons = !match_count_text_->text().empty() || !no_match;
msw 2016/02/03 19:58:02 This change seems unrelated; why is it part of thi
Mario Pistrich 2016/02/03 20:41:59 I changed this so that the focus is not moved to t
msw 2016/02/03 21:43:34 Sorry, when/how is focus moved to the close button
Mario Pistrich 2016/02/03 23:32:54 I should have described the reason of the change m
msw 2016/02/04 00:35:20 Hmm, it's too bad that the complexity of this desi
find_previous_button_->SetEnabled(enable_buttons);
find_next_button_->SetEnabled(enable_buttons);

Powered by Google App Engine
This is Rietveld 408576698