Commit 112a063a authored by Federico Paredes's avatar Federico Paredes Committed by Commit Bot

macOS: Use ignored accessibility role for MenuScrollViewContainer.

MenuScrollViewContainer now has a kIgnored (instead of kMenuBar) role on
Mac. This allows the SubmenuView to be recognized as a menu by VoiceOver,
so it can now read the total number of MenuItemViews inside it when
navigating via keyboard.

Bug: 954701
Change-Id: I4ee11c09d3331d55899ece6741f9821cbd3b2285
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402098
Commit-Queue: Federico Paredes <fedpar@microsoft.com>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805884}
parent e118f087
......@@ -8,6 +8,7 @@
#include <memory>
#include "base/macros.h"
#include "build/build_config.h"
#include "cc/paint/paint_flags.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/accessibility/ax_enums.mojom.h"
......@@ -252,7 +253,16 @@ void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) {
void MenuScrollViewContainer::GetAccessibleNodeData(ui::AXNodeData* node_data) {
// Get the name from the submenu view.
content_view_->GetAccessibleNodeData(node_data);
// On macOS, NSMenus are not supposed to have anything wrapped around them. To
// allow VoiceOver to recognize this as a menu and to read aloud the total
// number of items inside it, we ignore the MenuScrollViewContainer (which
// holds the menu itself: the SubmenuView).
#if defined(OS_MAC)
node_data->role = ax::mojom::Role::kIgnored;
#else
node_data->role = ax::mojom::Role::kMenuBar;
#endif
}
void MenuScrollViewContainer::OnBoundsChanged(
......
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