Improve a11y of GlanceablesTaskView
Bug: b/294681832 Change-Id: Ia1e14236386d9dfc4c1b6aadd6cfcbcc43a56ba9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4775218 Commit-Queue: Artsiom Mitrokhin <amitrokhin@chromium.org> Reviewed-by: Yulun Wu <yulunwu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1182674}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
660c99547a
commit
707ec5cc58
ash
ash_strings.grd
ash_strings_grd
IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DETAILS_ACCESSIBLE_DESCRIPTION.png.sha1IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DUE_DATE_ACCESSIBLE_DESCRIPTION.png.sha1IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_SUBTASK_ACCESSIBLE_DESCRIPTION.png.sha1IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_COMPLETED_ACCESSIBLE_NAME.png.sha1IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_NOT_COMPLETED_ACCESSIBLE_NAME.png.sha1IDS_GLANCEABLES_TASKS_TASK_ITEM_METADATA_WRAPPER_ACCESSIBLE_DESCRIPTION.png.sha1
glanceables
@ -6871,6 +6871,24 @@ New install
|
||||
<message name="IDS_GLANCEABLES_TASKS_SEE_ALL_BUTTON_ACCESSIBLE_NAME" desc="The glanceable displays tasks items fetched from Google Tasks API. Glanceables UI renders only limited number of items, the rest of them can be seen by clicking this button, which will open a corresponding website. This is the text announced by ChromeVox for this button.">
|
||||
See all tasks on Google tasks on web
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DUE_DATE_ACCESSIBLE_DESCRIPTION" desc="The glanceable displays tasks items fetched from Google Tasks API. This text is the part of a11y description to announce that a task has attached due date as part of its metadata.">
|
||||
due date <ph name="DUE_DATE">$1<ex>Wed, Aug 23</ex></ph>
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_SUBTASK_ACCESSIBLE_DESCRIPTION" desc="The glanceable displays tasks items fetched from Google Tasks API. This text is the part of a11y description to announce that a task contains any number of subtasks.">
|
||||
subtask
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DETAILS_ACCESSIBLE_DESCRIPTION" desc="The glanceable displays tasks items fetched from Google Tasks API. This text is the part of a11y description to announce that a task contains additional details.">
|
||||
details
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_TASK_ITEM_METADATA_WRAPPER_ACCESSIBLE_DESCRIPTION" desc="The glanceable displays tasks items fetched from Google Tasks API. This is the wrapper text for the a11y description to announce that a task has additional metadata (due date, subtasks, details, etc.).">
|
||||
This item has: <ph name="GLANCEABLES_TASK_ITEM_METADATA">$1<ex>due date Wed, Aug 23, subtask, details</ex></ph>.
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_COMPLETED_ACCESSIBLE_NAME" desc="The glanceable displays tasks items fetched from Google Tasks API. This is the a11y name announced by ChromeVox for the checkbox button to mark a task as completed.">
|
||||
Mark completed
|
||||
</message>
|
||||
<message name="IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_NOT_COMPLETED_ACCESSIBLE_NAME" desc="The glanceable displays tasks items fetched from Google Tasks API. This is the a11y name announced by ChromeVox for the checkbox button to mark a task as not completed.">
|
||||
Mark as not completed
|
||||
</message>
|
||||
|
||||
<!-- Do Not Disturb notification -->
|
||||
<message name="IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_TITLE" desc="Label used for the notification that shows up when the 'Do Not Disturb' feature is enabled.">
|
||||
|
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DETAILS_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DETAILS_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
f5ec262d7ab1bd292b493761e861909430b4d428
|
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DUE_DATE_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DUE_DATE_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
8020d194d5365ff108de6a860046f8c7945a7def
|
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_SUBTASK_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_SUBTASK_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
5dd4ae9b52c5ba7c87084b54d1373d96326fbcbc
|
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_COMPLETED_ACCESSIBLE_NAME.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_COMPLETED_ACCESSIBLE_NAME.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
f7569786fb92d9dece25d80632152744f7a68c69
|
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_NOT_COMPLETED_ACCESSIBLE_NAME.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_NOT_COMPLETED_ACCESSIBLE_NAME.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
e207c579ee95fc397489a0ddbae3b143270809ef
|
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_METADATA_WRAPPER_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_GLANCEABLES_TASKS_TASK_ITEM_METADATA_WRAPPER_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
e88e8c53894e58643b6dd22cde6296c9ff1e4491
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "ash/glanceables/glanceables_v2_controller.h"
|
||||
#include "ash/glanceables/tasks/glanceables_tasks_client.h"
|
||||
@ -85,17 +86,20 @@ std::unique_ptr<views::ImageView> CreateSecondRowIcon(
|
||||
|
||||
class GlanceablesTaskView::CheckButton : public views::ImageButton {
|
||||
public:
|
||||
CheckButton(PressedCallback pressed_callback)
|
||||
: views::ImageButton(pressed_callback) {
|
||||
explicit CheckButton(PressedCallback pressed_callback)
|
||||
: views::ImageButton(std::move(pressed_callback)) {
|
||||
SetAccessibleRole(ax::mojom::Role::kCheckBox);
|
||||
// TODO(b/294681832): Finalize, and then localize strings.
|
||||
SetAccessibleName(u"Mark completed");
|
||||
UpdateImage();
|
||||
}
|
||||
|
||||
void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
|
||||
views::ImageButton::GetAccessibleNodeData(node_data);
|
||||
|
||||
node_data->SetName(l10n_util::GetStringUTF16(
|
||||
checked_
|
||||
? IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_NOT_COMPLETED_ACCESSIBLE_NAME
|
||||
: IDS_GLANCEABLES_TASKS_TASK_ITEM_MARK_COMPLETED_ACCESSIBLE_NAME));
|
||||
|
||||
const ax::mojom::CheckedState checked_state =
|
||||
checked_ ? ax::mojom::CheckedState::kTrue
|
||||
: ax::mojom::CheckedState::kFalse;
|
||||
@ -163,11 +167,14 @@ GlanceablesTaskView::GlanceablesTaskView(const std::string& task_list_id,
|
||||
tasks_details_view_->AddChildView(
|
||||
CreateSecondRowIcon(kGlanceablesTasksDueDateIcon));
|
||||
|
||||
const auto formatted_due_date = GetFormattedDueDate(task->due.value());
|
||||
details.push_back(l10n_util::GetStringFUTF16(
|
||||
IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DUE_DATE_ACCESSIBLE_DESCRIPTION,
|
||||
formatted_due_date));
|
||||
|
||||
views::Label* due_date_label = SetupLabel(tasks_details_view_);
|
||||
due_date_label->SetText(GetFormattedDueDate(task->due.value()));
|
||||
due_date_label->SetText(formatted_due_date);
|
||||
due_date_label->SetProperty(views::kMarginsKey, kSecondRowItemsMargin);
|
||||
// TODO(b/294681832): Finalize, and then localize strings.
|
||||
details.push_back(u"Due " + GetFormattedDueDate(task->due.value()));
|
||||
due_date_label->SetFontList(
|
||||
TypographyProvider::Get()->ResolveTypographyToken(
|
||||
TypographyToken::kCrosAnnotation1));
|
||||
@ -182,15 +189,15 @@ GlanceablesTaskView::GlanceablesTaskView(const std::string& task_list_id,
|
||||
}
|
||||
|
||||
if (task->has_subtasks) {
|
||||
// TODO(b/294681832): Finalize, and then localize strings.
|
||||
details.push_back(u"Has subtasks");
|
||||
details.push_back(l10n_util::GetStringUTF16(
|
||||
IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_SUBTASK_ACCESSIBLE_DESCRIPTION));
|
||||
tasks_details_view_->AddChildView(
|
||||
CreateSecondRowIcon(kGlanceablesSubtaskIcon));
|
||||
}
|
||||
|
||||
if (task->has_notes) {
|
||||
// TODO(b/294681832): Finalize, and then localize strings.
|
||||
details.push_back(u"Has notes");
|
||||
details.push_back(l10n_util::GetStringUTF16(
|
||||
IDS_GLANCEABLES_TASKS_TASK_ITEM_HAS_DETAILS_ACCESSIBLE_DESCRIPTION));
|
||||
tasks_details_view_->AddChildView(
|
||||
CreateSecondRowIcon(kGlanceablesTasksNotesIcon));
|
||||
}
|
||||
@ -204,8 +211,14 @@ GlanceablesTaskView::GlanceablesTaskView(const std::string& task_list_id,
|
||||
button_->SetProperty(views::kMarginsKey, double_row ? kDoubleRowButtonMargin
|
||||
: kSingleRowButtonMargin);
|
||||
|
||||
button_->SetAccessibleDescription(base::UTF8ToUTF16(task->title) + u", " +
|
||||
base::JoinString(details, u", "));
|
||||
auto a11y_description = base::UTF8ToUTF16(task->title);
|
||||
if (!details.empty()) {
|
||||
a11y_description += u". ";
|
||||
a11y_description += l10n_util::GetStringFUTF16(
|
||||
IDS_GLANCEABLES_TASKS_TASK_ITEM_METADATA_WRAPPER_ACCESSIBLE_DESCRIPTION,
|
||||
base::JoinString(details, u", "));
|
||||
}
|
||||
button_->SetAccessibleDescription(a11y_description);
|
||||
button_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user