overview: Add snap groups a11y readout
Demo: https://b.corp.google.com/issues/345546016#comment3
Test: manual
Fixed: b:345546016
Change-Id: Ib60c72865fd5cc9f233378f89e462ccc93989d2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5608360
Commit-Queue: Sophie Wen <sophiewen@chromium.org>
Reviewed-by: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: Michele Fan <michelefan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1312342}
diff --git a/ash/wm/overview/overview_item_view.cc b/ash/wm/overview/overview_item_view.cc
index 34a7102..ef29924 100644
--- a/ash/wm/overview/overview_item_view.cc
+++ b/ash/wm/overview/overview_item_view.cc
@@ -314,10 +314,17 @@
// TODO: This doesn't allow |this| to be navigated by ChromeVox, find a way
// to allow |this| as well as the title and close button.
node_data->role = ax::mojom::Role::kGenericContainer;
+ const bool is_group_item = [&]() {
+ auto* snap_group_controller = SnapGroupController::Get();
+ return snap_group_controller &&
+ snap_group_controller->GetSnapGroupForGivenWindow(source_window());
+ }();
node_data->AddStringAttribute(
ax::mojom::StringAttribute::kDescription,
l10n_util::GetStringUTF8(
- IDS_ASH_OVERVIEW_CLOSABLE_HIGHLIGHT_ITEM_A11Y_EXTRA_TIP));
+ is_group_item
+ ? IDS_ASH_SNAP_GROUP_WINDOW_CYCLE_DESCRIPTION
+ : IDS_ASH_OVERVIEW_CLOSABLE_HIGHLIGHT_ITEM_A11Y_EXTRA_TIP));
}
void OverviewItemView::OnThemeChanged() {
diff --git a/ash/wm/snap_group/snap_group_controller.cc b/ash/wm/snap_group/snap_group_controller.cc
index 1c95354..6c8decb 100644
--- a/ash/wm/snap_group/snap_group_controller.cc
+++ b/ash/wm/snap_group/snap_group_controller.cc
@@ -191,6 +191,9 @@
SnapGroup* SnapGroupController::GetSnapGroupForGivenWindow(
const aura::Window* window) const {
+ if (!window) {
+ return nullptr;
+ }
auto iter = window_to_snap_group_map_.find(window);
return iter != window_to_snap_group_map_.end() ? iter->second : nullptr;
}