Commit 5bf8d883 authored by Federico Paredes's avatar Federico Paredes Committed by Commit Bot

Re-added menu accessibility logic.

This CL[1] removed the logic that allowed screen readers to focus into
menus. This[2] other CL re-added functionality for generic menu items.
However, buttons within menu items (like those in the Zoom MenuItemView)
weren't fixed.

This CL fixes hot button focus with screen readers. This only fixes the
issue with keyboard navigation, and not with mouse navigation. If you
use your mouse to navigate to a button, it will still select the entire
container.

Bug: 1105917
Change-Id: I3ab23364f2e63f8429e4bc8eba2ace4467a0dd91

[1] c22c3a2a
[2] 7750c6d5

Change-Id: I3ab23364f2e63f8429e4bc8eba2ace4467a0dd91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2295787Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789295}
parent d2d9d94b
...@@ -3116,20 +3116,18 @@ void MenuController::SetNextHotTrackedView( ...@@ -3116,20 +3116,18 @@ void MenuController::SetNextHotTrackedView(
} }
void MenuController::SetHotTrackedButton(Button* hot_button) { void MenuController::SetHotTrackedButton(Button* hot_button) {
if (hot_button == hot_button_) { // If we're providing a new hot-tracked button, first remove the existing one.
// Hot-tracked state may change outside of the MenuController. Correct it. if (hot_button_ && hot_button_ != hot_button) {
if (hot_button && !hot_button->IsHotTracked()) {
hot_button->SetHotTracked(true);
hot_button->NotifyAccessibilityEvent(ax::mojom::Event::kSelection, true);
}
return;
}
if (hot_button_)
hot_button_->SetHotTracked(false); hot_button_->SetHotTracked(false);
hot_button_->GetViewAccessibility().EndPopupFocusOverride();
}
// Then set the new one.
hot_button_ = hot_button; hot_button_ = hot_button;
if (hot_button) { if (hot_button_ && !hot_button_->IsHotTracked()) {
hot_button->SetHotTracked(true); hot_button_->GetViewAccessibility().SetPopupFocusOverride();
hot_button->NotifyAccessibilityEvent(ax::mojom::Event::kSelection, true); hot_button_->SetHotTracked(true);
hot_button_->NotifyAccessibilityEvent(ax::mojom::Event::kSelection, true);
} }
} }
......
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