Commit 1b537ed8 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Clear focus after located event is not handled

This solves the issue:
After the user taps or clicks outside the folder name, the text should
be deactivated.

Bug: 815071
Change-Id: Ic8b77fb171d16c59198ccc1112d1b5dcb07a701d
Reviewed-on: https://chromium-review.googlesource.com/951718Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541170}
parent 84a3a47c
......@@ -524,6 +524,9 @@ void AppListView::InitializeFullscreen(gfx::NativeView parent,
}
void AppListView::HandleClickOrTap(ui::LocatedEvent* event) {
// Clear focus if the located event is not handled by any child view.
GetFocusManager()->ClearFocus();
// No-op if app list is on fullscreen all apps state and the event location is
// within apps grid view's bounds.
if (app_list_state_ == AppListViewState::FULLSCREEN_ALL_APPS &&
......
......@@ -193,13 +193,6 @@ void FolderHeaderView::Layout() {
folder_name_view_->SetBoundsRect(text_bounds);
}
bool FolderHeaderView::OnKeyPressed(const ui::KeyEvent& event) {
if (event.key_code() == ui::VKEY_RETURN)
delegate_->GiveBackFocusToSearchBox();
return false;
}
void FolderHeaderView::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
// Temporarily remove from observer to ignore data change caused by us.
......@@ -221,6 +214,11 @@ void FolderHeaderView::ContentsChanged(views::Textfield* sender,
bool FolderHeaderView::HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) {
if (key_event.key_code() == ui::VKEY_RETURN &&
key_event.type() == ui::ET_KEY_PRESSED) {
delegate_->GiveBackFocusToSearchBox();
return true;
}
if (!CanProcessLeftRightKeyTraversal(key_event))
return false;
return ProcessLeftRightKeyTraversalForTextfield(folder_name_view_, key_event);
......
......@@ -67,7 +67,6 @@ class APP_LIST_EXPORT FolderHeaderView : public views::View,
// views::View overrides:
void Layout() override;
bool OnKeyPressed(const ui::KeyEvent& event) override;
// views::TextfieldController overrides:
void ContentsChanged(views::Textfield* sender,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment