Commit 18c23b63 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Set hot tracked status again when users trigger a button and stay there

Bug: 1116942
Change-Id: Id2e05b209c5de82a83402d2eb28a85231424c4e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2364169
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800120}
parent 27f2b6cc
...@@ -3121,11 +3121,13 @@ void MenuController::SetNextHotTrackedView( ...@@ -3121,11 +3121,13 @@ void MenuController::SetNextHotTrackedView(
} }
void MenuController::SetHotTrackedButton(Button* new_hot_button) { void MenuController::SetHotTrackedButton(Button* new_hot_button) {
if (hot_button_ == new_hot_button) // Set hot tracked state and fire a11y events for the hot tracked button.
return; // This must be done whether or not it was the previous hot tracked button.
// For example, when a zoom button is pressed, the menu remains open and the
// same zoom button should have its hot tracked state set again.
// If we're providing a new hot-tracked button, first remove the existing one. // If we're providing a new hot-tracked button, first remove the existing one.
if (hot_button_) { if (hot_button_ && hot_button_ != new_hot_button) {
hot_button_->SetHotTracked(false); hot_button_->SetHotTracked(false);
hot_button_->GetViewAccessibility().EndPopupFocusOverride(); hot_button_->GetViewAccessibility().EndPopupFocusOverride();
} }
......
...@@ -1369,6 +1369,13 @@ TEST_F(MenuControllerTest, ChildButtonHotTrackedWhenNested) { ...@@ -1369,6 +1369,13 @@ TEST_F(MenuControllerTest, ChildButtonHotTrackedWhenNested) {
EXPECT_TRUE(button1->IsHotTracked()); EXPECT_TRUE(button1->IsHotTracked());
EXPECT_EQ(button1, GetHotButton()); EXPECT_EQ(button1, GetHotButton());
// Setting the hot tracked state twice on the same button via the
// menu controller should still set the hot tracked state on the button again.
button1->SetHotTracked(false);
SetHotTrackedButton(button1);
EXPECT_TRUE(button1->IsHotTracked());
EXPECT_EQ(button1, GetHotButton());
ExitMenuRun(); ExitMenuRun();
EXPECT_FALSE(button1->IsHotTracked()); EXPECT_FALSE(button1->IsHotTracked());
EXPECT_TRUE(button2->IsHotTracked()); EXPECT_TRUE(button2->IsHotTracked());
......
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