Commit 21524729 authored by Ahmed's avatar Ahmed Committed by Commit Bot

Desks: Fix a11y announcement of desk in overview

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=1067392c
TEST=Manually

Change-Id: I1646e0aeff95f089a9f2252532b09f2c7acdcb3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134920Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756312}
parent edb168aa
......@@ -191,15 +191,21 @@ 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()) {
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()) {
node_data->AddStringAttribute(
......
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