-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Launcher Sort] Fix toast/continue section blinking during app list sort
When an app list item has focus before app list reorder, the reorder toast and continue section blinks during reorder animation. Please see the crbug for detailed diagnosis. This CL fixes such an issue by focusing on search box before starting the reorder animation. In detail, this CL does the following things: (1) In `AppListPresenterImpl` and `AppListBubbleView`, before triggering apps grid reorder animation, move the focus to the search box. (2) In order to avoid the a11y side effects brought by setting focus, disable the search box from handling a11y events at the start of the reorder animation. Re-enable when the reorder animation ends. (3) Add a test helper class called `AppListFocusChangeListener` to verify that when app list is reordered with focus on an item, the focus only changes once from the item to the search box. Bug: 1305378 Change-Id: I9d4d561cd4de64d1da899e5dcc79bf7b026d47e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3525913 Reviewed-by: Toni Barzic <tbarzic@chromium.org> Commit-Queue: Andrew Xu <andrewxu@chromium.org> Cr-Commit-Position: refs/heads/main@{#983420}
- Loading branch information
Andrew Xu
authored and
Chromium LUCI CQ
committed
Mar 21, 2022
1 parent
41345b3
commit 5f19014
Showing
15 changed files
with
328 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/app_list/test/test_focus_change_listener.h" | ||
|
||
#include "ash/app_list/test/app_list_test_helper.h" | ||
#include "ash/app_list/views/apps_grid_view.h" | ||
|
||
namespace ash { | ||
|
||
namespace { | ||
static TestFocusChangeListener* g_instance = nullptr; | ||
} | ||
|
||
TestFocusChangeListener::TestFocusChangeListener( | ||
views::FocusManager* focus_manager) | ||
: focus_manager_(focus_manager) { | ||
DCHECK(focus_manager_); | ||
focus_manager_->AddFocusChangeListener(this); | ||
|
||
DCHECK(!g_instance); | ||
g_instance = this; | ||
} | ||
|
||
TestFocusChangeListener::~TestFocusChangeListener() { | ||
focus_manager_->RemoveFocusChangeListener(this); | ||
|
||
DCHECK_EQ(g_instance, this); | ||
g_instance = nullptr; | ||
} | ||
|
||
// views::FocusChangeListener: | ||
void TestFocusChangeListener::OnDidChangeFocus(views::View* focused_before, | ||
views::View* focused_now) { | ||
++focus_change_count_; | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_APP_LIST_TEST_TEST_FOCUS_CHANGE_LISTENER_H_ | ||
#define ASH_APP_LIST_TEST_TEST_FOCUS_CHANGE_LISTENER_H_ | ||
|
||
#include "ui/views/focus/focus_manager.h" | ||
|
||
namespace ash { | ||
|
||
// A helper class to observe focus changes on the specified focus manager. | ||
class TestFocusChangeListener : public views::FocusChangeListener { | ||
public: | ||
explicit TestFocusChangeListener(views::FocusManager* focus_manager); | ||
TestFocusChangeListener(const TestFocusChangeListener&) = delete; | ||
TestFocusChangeListener& operator=(const TestFocusChangeListener&) = delete; | ||
~TestFocusChangeListener() override; | ||
|
||
// views::FocusChangeListener: | ||
void OnWillChangeFocus(views::View* focused_before, | ||
views::View* focused_now) override {} | ||
void OnDidChangeFocus(views::View* focused_before, | ||
views::View* focused_now) override; | ||
|
||
int focus_change_count() { return focus_change_count_; } | ||
|
||
private: | ||
views::FocusManager* const focus_manager_; | ||
|
||
// Records the count of focus changes. | ||
int focus_change_count_ = 0; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_APP_LIST_TEST_TEST_FOCUS_CHANGE_LISTENER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.