0

Add accessible names for the "See all" buttons

This includes classroom and tasks bubbles, the text is bubble
dependent.

Bug: b/294681832
Change-Id: I5ede027f6d04195e3f5605ab13694e8549d1082c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4762812
Commit-Queue: Artsiom Mitrokhin <amitrokhin@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1182031}
This commit is contained in:
Artsiom Mitrokhin
2023-08-10 14:21:04 +00:00
committed by Chromium LUCI CQ
parent 11fbb20d53
commit 4f2e70ac94
7 changed files with 36 additions and 15 deletions

@ -6865,6 +6865,12 @@ New install
<message name="IDS_GLANCEABLES_ERROR_DISMISS" desc="A glanceables bubble (classroom or tasks) displays a notification with an error message when an error occurs during any action within said glaceables bubble. This is the text that is displayed on the button within said notification in order to dismiss it.">
Dismiss
</message>
<message name="IDS_GLANCEABLES_CLASSROOM_SEE_ALL_BUTTON_ACCESSIBLE_NAME" desc="The glanceable displays classroom items fetched from Google Classroom 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 classwork on Google Classroom website
</message>
<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>
<!-- 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.">

@ -0,0 +1 @@
620c1751a8adc9b081888145792e854ef3ff3f10

@ -0,0 +1 @@
11d3299bc49157ab748aec4aee422a9d1de5845b

@ -6,6 +6,7 @@
#include <algorithm>
#include <memory>
#include <string>
#include "ash/glanceables/common/glanceables_view_id.h"
#include "ash/strings/grit/ash_strings.h"
@ -15,6 +16,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/types/cxx23_to_underlying.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
@ -30,14 +32,16 @@
#include "ui/views/view_class_properties.h"
namespace ash {
namespace {
constexpr int kSeeAllIconSize = 24;
constexpr int kFooterVerticalSpacing = 7;
constexpr int kFooterStartSpacing = 6;
class ASH_EXPORT SeeAllButton : public views::LabelButton {
class SeeAllButton : public views::LabelButton {
public:
SeeAllButton(base::RepeatingClosure on_see_all_pressed) {
SeeAllButton(const std::u16string& see_all_accessible_name,
base::RepeatingClosure on_see_all_pressed) {
SetText(l10n_util::GetStringUTF16(
IDS_GLANCEABLES_LIST_FOOTER_ACTION_BUTTON_LABEL));
SetCallback(std::move(on_see_all_pressed));
@ -50,6 +54,7 @@ class ASH_EXPORT SeeAllButton : public views::LabelButton {
SetTextColorId(views::Button::STATE_NORMAL, cros_tokens::kCrosSysOnSurface);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
*label());
SetAccessibilityProperties(ax::mojom::Role::kLink, see_all_accessible_name);
}
SeeAllButton(const SeeAllButton&) = delete;
@ -57,7 +62,10 @@ class ASH_EXPORT SeeAllButton : public views::LabelButton {
~SeeAllButton() override = default;
};
} // namespace
GlanceablesListFooterView::GlanceablesListFooterView(
const std::u16string& see_all_accessible_name,
base::RepeatingClosure on_see_all_pressed) {
SetCrossAxisAlignment(views::LayoutAlignment::kCenter);
@ -79,8 +87,8 @@ GlanceablesListFooterView::GlanceablesListFooterView(
views::MaximumFlexSizeRule::kUnbounded))
.Build());
see_all_button_ =
AddChildView(std::make_unique<SeeAllButton>(on_see_all_pressed));
see_all_button_ = AddChildView(std::make_unique<SeeAllButton>(
see_all_accessible_name, on_see_all_pressed));
SetProperty(views::kMarginsKey,
gfx::Insets::TLBR(kFooterVerticalSpacing, kFooterStartSpacing,

@ -5,6 +5,8 @@
#ifndef ASH_GLANCEABLES_COMMON_GLANCEABLES_LIST_FOOTER_VIEW_H_
#define ASH_GLANCEABLES_COMMON_GLANCEABLES_LIST_FOOTER_VIEW_H_
#include <string>
#include "ash/ash_export.h"
#include "base/allocator/partition_allocator/pointers/raw_ptr.h"
#include "base/functional/callback_forward.h"
@ -24,7 +26,8 @@ class ASH_EXPORT GlanceablesListFooterView : public views::FlexLayoutView {
public:
METADATA_HEADER(GlanceablesListFooterView);
explicit GlanceablesListFooterView(base::RepeatingClosure on_see_all_pressed);
GlanceablesListFooterView(const std::u16string& see_all_accessible_name,
base::RepeatingClosure on_see_all_pressed);
GlanceablesListFooterView(const GlanceablesListFooterView&) = delete;
GlanceablesListFooterView& operator=(const GlanceablesListFooterView&) =
delete;

@ -16,17 +16,15 @@
#include "ash/glanceables/glanceables_v2_controller.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/typography.h"
#include "base/functional/bind.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/types/cxx23_to_underlying.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/combobox_model.h"
#include "ui/base/models/image_model.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
@ -111,9 +109,11 @@ ClassroomBubbleBaseView::ClassroomBubbleBaseView(
GlanceablesViewId::kClassroomBubbleEmptyListLabel))
.Build());
list_footer_view_ = AddChildView(
std::make_unique<GlanceablesListFooterView>(base::BindRepeating(
&ClassroomBubbleBaseView::OnSeeAllPressed, base::Unretained(this))));
list_footer_view_ = AddChildView(std::make_unique<GlanceablesListFooterView>(
l10n_util::GetStringUTF16(
IDS_GLANCEABLES_CLASSROOM_SEE_ALL_BUTTON_ACCESSIBLE_NAME),
base::BindRepeating(&ClassroomBubbleBaseView::OnSeeAllPressed,
base::Unretained(this))));
list_footer_view_->SetID(
base::to_underlying(GlanceablesViewId::kClassroomBubbleListFooter));
}

@ -163,9 +163,11 @@ void TasksBubbleView::InitViews(ui::ListModel<GlanceablesTaskList>* task_list) {
&TasksBubbleView::SelectedTasksListChanged, base::Unretained(this)));
task_list_combo_box_view_->SetSelectedIndex(0);
list_footer_view_ = AddChildView(
std::make_unique<GlanceablesListFooterView>(base::BindRepeating(
&TasksBubbleView::ActionButtonPressed, base::Unretained(this))));
list_footer_view_ = AddChildView(std::make_unique<GlanceablesListFooterView>(
l10n_util::GetStringUTF16(
IDS_GLANCEABLES_TASKS_SEE_ALL_BUTTON_ACCESSIBLE_NAME),
base::BindRepeating(&TasksBubbleView::ActionButtonPressed,
base::Unretained(this))));
list_footer_view_->SetID(
base::to_underlying(GlanceablesViewId::kTasksBubbleListFooter));