0

Add a11y description to announce the number of apps in a folder

In the folder icon UI refresh, we added the app counter on the folder
icon so that the users can see how many apps are in a folder at the
first glance. To provide an equitable experience for chromevox users,
This cl adds the a11y string to announce the number of apps in a folder
when focusing on it.

screenshot: https://screenshot.googleplex.com/64fUyz6n8gnWPwj

Bug: b:274728929
Change-Id: If9d7c03901673291cf204f2dad12d840e8b8ddbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4362800
Commit-Queue: Wen-Chien Wang <wcwang@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1120847}
This commit is contained in:
Wen-Chien Wang
2023-03-22 22:53:07 +00:00
committed by Chromium LUCI CQ
parent d1db59bf77
commit 3461d49bb7
3 changed files with 33 additions and 6 deletions

@ -902,26 +902,47 @@ void AppListItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
return;
}
// The list of descriptions to be announced.
std::vector<std::u16string> descriptions;
if (item_weak_->is_folder() &&
features::IsAppCollectionFolderRefreshEnabled()) {
// For folder items, announce the number of apps in the folder.
std::u16string app_count_announcement = l10n_util::GetPluralStringFUTF16(
IDS_APP_LIST_FOLDER_NUMBER_OF_APPS_ACCESSIBILE_DESCRIPTION,
item_weak_->AsFolderItem()->ChildItemCount());
descriptions.push_back(app_count_announcement);
}
auto app_status = item_weak_->app_status();
std::u16string app_status_description;
switch (app_status) {
case AppStatus::kBlocked:
node_data->SetDescription(
app_status_description =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_APP_LIST_BLOCKED_APP));
IDS_APP_LIST_BLOCKED_APP);
break;
case AppStatus::kPaused:
node_data->SetDescription(
app_status_description =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_APP_LIST_PAUSED_APP));
IDS_APP_LIST_PAUSED_APP);
break;
default:
if (item_weak_->is_new_install()) {
node_data->SetDescription(
app_status_description =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION));
IDS_APP_LIST_NEW_INSTALL_ACCESSIBILE_DESCRIPTION);
}
break;
}
if (!app_status_description.empty()) {
descriptions.push_back(app_status_description);
}
// Set the concatenated descriptions.
if (!descriptions.empty()) {
node_data->SetDescription(base::JoinString(descriptions, u" "));
}
}
void AppListItemView::OnContextMenuModelReceived(

@ -6039,6 +6039,11 @@ New install
<message name="IDS_APP_LIST_FOLDER_BUTTON_ACCESSIBILE_NAME" desc="The spoken feedback text for navigating to a folder button in top level app list">
Folder <ph name="folder_name">$1<ex>OEM Apps</ex></ph>
</message>
<message name="IDS_APP_LIST_FOLDER_NUMBER_OF_APPS_ACCESSIBILE_DESCRIPTION" desc="The spoken feedback text that announces the number of apps in a folder when navigating to the folder button in top level app list">
{NUM_APPS, plural,
=1 {1 app}
other {# apps}}
</message>
<message name="IDS_APP_LIST_FOLDER_CLOSE_FOLDER_ACCESSIBILE_NAME" desc="The spoken feedback text for closing an app launcher folder">
Close folder
</message>

@ -0,0 +1 @@
eba145d904aa0b997a6a49ef2cc6824b262a6a2e