0

Fix chromevox announcements for AppsCollections

Resolve some chromebox navigation issues in AppsCollections:
- Add a region for the exit tutorial view nudge so users have more
  spoken context when focusing the dismiss button.
- Add description for apps that contain the collection they belong to.
- Define the accessible name on the dialog that shows after sorting apps
so that chromebox is able to give spoken feedback on the whole view.

Screen recording: go/cvox-apps-collections

Bug: b:331959966, b:331958206, b:331955322
Change-Id: I03ce3aabe373695db5af1cd3721bbc539afc7295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5435608
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Commit-Queue: Ana Salazar <anasalazar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1284797}
This commit is contained in:
Ana Salazar
2024-04-10 00:17:48 +00:00
committed by Chromium LUCI CQ
parent 052e43ccc0
commit d31b91bd7e
5 changed files with 27 additions and 1 deletions

@ -11,6 +11,7 @@
#include <utility>
#include <vector>
#include "ash/app_list/app_collections_constants.h"
#include "ash/app_list/app_list_item_util.h"
#include "ash/app_list/app_list_metrics.h"
#include "ash/app_list/app_list_util.h"
@ -1297,6 +1298,10 @@ void AppListItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
descriptions.push_back(app_status_description);
}
if (context_ == Context::kAppsCollection) {
descriptions.push_back(GetAppCollectionName(item_weak_->collection_id()));
}
// Set the concatenated descriptions.
if (!descriptions.empty()) {
node_data->SetDescription(base::JoinString(descriptions, u" "));

@ -217,6 +217,9 @@ void AppListToastContainerView::CreateTutorialNudgeView() {
.SetIconBackground(true);
toast_view_ = AddChildView(toast_view_builder.Build());
toast_view_->SetAccessibleRole(ax::mojom::Role::kRegion);
toast_view_->toast_button()->SetAccessibleName(l10n_util::GetStringUTF16(
IDS_ASH_LAUNCHER_APPS_COLLECTIONS_NUDGE_DISMISS_BUTTON_SPOKEN_TEXT));
if (available_width_) {
toast_view_->SetAvailableWidth(*available_width_);
}

@ -21,6 +21,7 @@
#include "ui/color/color_id.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/controls/label.h"
#include "ui/views/highlight_border.h"
@ -80,6 +81,9 @@ AppsCollectionsDismissDialog::AppsCollectionsDismissDialog(
// Needs to paint to layer so it's stacked above `this` view.
title_->SetPaintToLayer();
title_->layer()->SetFillsBoundsOpaquely(false);
// Ignore labels for accessibility - the accessible name is defined for the
// whole dialog view.
title_->GetViewAccessibility().SetIsIgnored(true);
// Add dialog body.
auto* body =
@ -97,6 +101,9 @@ AppsCollectionsDismissDialog::AppsCollectionsDismissDialog(
// Needs to paint to layer so it's stacked above `this` view.
body->SetPaintToLayer();
body->layer()->SetFillsBoundsOpaquely(false);
// Ignore labels for accessibility - the accessible name is defined for the
// whole dialog view.
body->GetViewAccessibility().SetIsIgnored(true);
auto run_callback = [](AppsCollectionsDismissDialog* dialog, bool accept) {
if (!dialog->confirm_callback_) {
@ -131,11 +138,18 @@ AppsCollectionsDismissDialog::AppsCollectionsDismissDialog(
l10n_util::GetStringUTF16(
IDS_ASH_LAUNCHER_APPS_COLLECTIONS_DISMISS_DIALOG_EXIT),
PillButton::Type::kPrimaryWithoutIcon, nullptr));
SetAccessibleRole(ax::mojom::Role::kAlertDialog);
SetAccessibleName(base::JoinString(
{l10n_util::GetStringUTF16(
IDS_ASH_LAUNCHER_APPS_COLLECTIONS_DISMISS_DIALOG_TITLE),
l10n_util::GetStringUTF16(
IDS_ASH_LAUNCHER_APPS_COLLECTIONS_DISMISS_DIALOG_SUBTITLE)},
u", "));
}
AppsCollectionsDismissDialog::~AppsCollectionsDismissDialog() {}
// views::View:
gfx::Size AppsCollectionsDismissDialog::CalculatePreferredSize() const {
const int default_width = kDialogWidth;
return gfx::Size(default_width, GetHeightForWidth(default_width));

@ -6734,6 +6734,9 @@ Here are some things you can try to get started.
<message name="IDS_ASH_LAUNCHER_APPS_COLLECTIONS_NUDGE_DISMISS_BUTTON" desc="Label for the Apps Collections Tutorial View nudge button that show on top of the Apps Collections in the Launcher. The tutorial view displays apps categorized in different subsets. Clicking the button will return users to the default launcher with apps displayed in a grid.">
Exit
</message>
<message name="IDS_ASH_LAUNCHER_APPS_COLLECTIONS_NUDGE_DISMISS_BUTTON_SPOKEN_TEXT" desc="Accessibility text read by chromevox when focusing the Apps Collections Tutorial View nudge button that show on top of the Apps Collections in the Launcher. The tutorial view displays apps categorized in different subsets. Clicking the button will return users to the default launcher with apps displayed in a grid.">
Exit tutorial view
</message>
<message name="IDS_ASH_LAUNCHER_APPS_COLLECTIONS_DISMISS_DIALOG_TITLE" desc="Text for the Apps Collections Tutorial View dismiss dialog that shows over the Apps Collections in the Launcher when the user attempts to sort their apps. The dialog serves as confirmation to exit the Apps Collections Tutorial View">
Exit view?
</message>

@ -0,0 +1 @@
740365049bd569265e8b6302da46a5ae68a0db56