0

Reland "desks: Change ChromeVox for mini view (1)"

This is a reland of commit 297e5c171d

Original change's description:
> desks: Change ChromeVox for mini view (1)
>
> This CL will change the announcement for desk preview. Also, we move the
> extra tip for mini view to the class of deks preview; the extra tip
> previously is not announced, cause in overview_highlight_controller, it
> only add mini_view->desk_preview and mini_view->desk_name_view into out
> traversable views.
>
> Screenshots:
> https://screenshot.googleplex.com/3zoUdnJNkNxZY6k
> https://screenshot.googleplex.com/8ih8rRMqjk4Dyro
> https://screenshot.googleplex.com/6jDjBy9mDqRq5fu
>
> Bug: b/286456085
> Test: Manual
> Change-Id: Ib7b6c34a149d60c9de32c07ec3824a5e73d0c3d2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4794458
> Commit-Queue: Hongyu Long <hongyulong@chromium.org>
> Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1186726}

Bug: b/286456085, b/297113736
Test: Manual & wmp.AdminTemplatesLaunch,wmp.DesksTemplatesLaunch
Change-Id: I960de58d66176f2d063e6e78746a67e44cfcddff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4807367
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Commit-Queue: Hongyu Long <hongyulong@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1187556}
This commit is contained in:
Hongyu Long
2023-08-23 23:32:30 +00:00
committed by Chromium LUCI CQ
parent fdec758e56
commit e8da0253e8
6 changed files with 41 additions and 27 deletions

@ -2531,14 +2531,17 @@ Style notes:
Last desk can't be removed.
</message>
<message name="IDS_ASH_DESKS_ACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP" desc="The accessibility tooltip read by screen readers for a highlighted active desk mini_view.">
Active desk.
active desk
</message>
<message name="IDS_ASH_DESKS_INACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP" desc="The accessibility tooltip read by screen readers for a highlighted inactive desk mini_view.">
Inactive desk.
inactive desk
</message>
<message name="IDS_ASH_DESKS_DESK_ACCESSIBLE_NAME" desc="The full accessible desk name">
Desk: <ph name="DESK_NAME">$1</ph>
</message>
<message name="IDS_ASH_DESKS_DESK_PREVIEW_A11Y_NAME" desc="The full accessible desk name">
Go to <ph name="ACTIVE_STATE">$1</ph> <ph name="DESK_NAME">$2</ph> button.
</message>
<message name="IDS_ASH_DESKS_DESK_NAME_COMMIT" desc="Alert when the desk name is committed">
Desk name was changed to <ph name="DESK_NAME">$1</ph>
</message>

@ -0,0 +1 @@
f0ab6cae002646d549b453d8462bb660fa4f46b2

@ -0,0 +1 @@
828c0f8080f2886b58e92b5ce5de44366924f884

@ -1 +1 @@
c0011f1a7d59d0e49a62cc6be9fe822a6a1cd403
052eae4fae5a6f4cfec48cce64759f0a3e615d7d

@ -506,36 +506,14 @@ gfx::Size DeskMiniView::CalculatePreferredSize() const {
}
void DeskMiniView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
desk_preview_->GetAccessibleNodeData(node_data);
// Note that the desk may have already been destroyed.
if (desk_) {
// Announce desk name.
// Add node name for the tast test. In `ash.LaunchSavedDesk`, it should have
// a node with the below name for the desk mini view.
node_data->AddStringAttribute(
ax::mojom::StringAttribute::kName,
l10n_util::GetStringFUTF8(IDS_ASH_DESKS_DESK_ACCESSIBLE_NAME,
desk_->name()));
node_data->AddStringAttribute(
ax::mojom::StringAttribute::kValue,
l10n_util::GetStringUTF8(
desk_->is_active()
? IDS_ASH_DESKS_ACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP
: IDS_ASH_DESKS_INACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP));
}
// If the desk can be combined or closed, add a tip to let the user know they
// can use an accelerator.
if (!DesksController::Get()->CanRemoveDesks())
return;
const std::u16string target_desk_name =
DesksController::Get()->GetCombineDesksTargetName(desk_);
const std::string extra_tip = l10n_util::GetStringFUTF8(
IDS_ASH_OVERVIEW_CLOSABLE_DESK_MINIVIEW_A11Y_EXTRA_TIP, target_desk_name);
node_data->AddStringAttribute(ax::mojom::StringAttribute::kDescription,
extra_tip);
}
void DeskMiniView::OnThemeChanged() {

@ -10,6 +10,7 @@
#include "ash/public/cpp/window_properties.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/style_util.h"
#include "ash/wallpaper/views/wallpaper_base_view.h"
#include "ash/wm/desks/desk.h"
@ -33,6 +34,7 @@
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/ui/wm/features.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
@ -504,6 +506,35 @@ void DeskPreviewView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
views::Button::GetAccessibleNodeData(node_data);
if (GetAccessibleName().empty())
node_data->SetNameExplicitlyEmpty();
// Note that the desk may have already been destroyed.
Desk* desk = mini_view_->desk();
if (desk) {
// Announce desk name.
node_data->AddStringAttribute(
ax::mojom::StringAttribute::kRoleDescription,
l10n_util::GetStringFUTF8(
IDS_ASH_DESKS_DESK_PREVIEW_A11Y_NAME,
l10n_util::GetStringUTF16(
desk->is_active()
? IDS_ASH_DESKS_ACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP
: IDS_ASH_DESKS_INACTIVE_DESK_MINIVIEW_A11Y_EXTRA_TIP),
desk->name()));
}
// If the desk can be combined or closed, add a tip to let the user know they
// can use an accelerator.
if (!DesksController::Get()->CanRemoveDesks()) {
return;
}
const std::u16string target_desk_name =
DesksController::Get()->GetCombineDesksTargetName(desk);
const std::string extra_tip = l10n_util::GetStringFUTF8(
IDS_ASH_OVERVIEW_CLOSABLE_DESK_MINIVIEW_A11Y_EXTRA_TIP, target_desk_name);
node_data->AddStringAttribute(ax::mojom::StringAttribute::kDescription,
extra_tip);
}
void DeskPreviewView::Layout() {