Skip to content

Commit

Permalink
Desks: Fix a11y announcement of desk in overview
Browse files Browse the repository at this point in the history
DeskMiniView was changed from a Button to a generic View, but
the actual button now is DeskPreviewView. The a11y node data should
be initialized first by the button, before we add the extra attributes.

Also announce the desk name if the miniview is selected.

BUG=1067392
TEST=Manually

Change-Id: I1646e0aeff95f089a9f2252532b09f2c7acdcb3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134920
Reviewed-by: Sammie Quon <sammiequon@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756312}
  • Loading branch information
Ahmed authored and Commit Bot committed Apr 3, 2020
1 parent edb168a commit 2152472
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ash/wm/desks/desk_mini_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,20 @@ gfx::Size DeskMiniView::CalculatePreferredSize() const {
}

void DeskMiniView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
views::View::GetAccessibleNodeData(node_data);
desk_preview_->GetAccessibleNodeData(node_data);

// Note that the desk may have already been destroyed.
if (desk_ && desk_->is_active()) {
node_data->AddStringAttribute(
ax::mojom::StringAttribute::kValue,
l10n_util::GetStringUTF8(
IDS_ASH_DESKS_ACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP));
if (desk_) {
// Announce desk name.
node_data->AddStringAttribute(ax::mojom::StringAttribute::kName,
base::UTF16ToUTF8(desk_->name()));

if (desk_->is_active()) {
node_data->AddStringAttribute(
ax::mojom::StringAttribute::kValue,
l10n_util::GetStringUTF8(
IDS_ASH_DESKS_ACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP));
}
}

if (DesksController::Get()->CanRemoveDesks()) {
Expand Down

0 comments on commit 2152472

Please sign in to comment.