VC UI: Update return to app summary row accessible name
Added a string to indicate expanded/collapsed state. Fixed: b:295940983 Change-Id: I663d7b78e12466b087d7bad80027a1e6b3a9e492 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4807767 Reviewed-by: Alex Newcomer <newcomer@chromium.org> Commit-Queue: Andre Le <leandre@chromium.org> Cr-Commit-Position: refs/heads/main@{#1187480}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
91d266d6a7
commit
b26962012a
@ -1698,6 +1698,14 @@ Style notes:
|
||||
<message name="VIDEO_CONFERENCE_RETURN_TO_APP_PERIPHERALS_ACCESSIBLE_NAME" desc="Tooltip shown for the return to app button regarding peripherals in the video conference panel.">
|
||||
<ph name="CAPTURE_MEDIUM">$1<ex>Camera</ex></ph> in use.
|
||||
</message>
|
||||
<message name="VIDEO_CONFERENCE_RETURN_TO_APP_EXPANDED_ACCESSIBLE_NAME" desc="The part of the accessible name that indicate if the return to app panel is expanded or collapsed.
|
||||
It also contains a separator (comma) to separate it from the rest of the accessible name that comes before it.">
|
||||
, expanded
|
||||
</message>
|
||||
<message name="VIDEO_CONFERENCE_RETURN_TO_APP_COLLAPSED_ACCESSIBLE_NAME" desc="The part of the accessible name that indicate if the return to app panel is expanded or collapsed.
|
||||
It also contains a separator (comma) to separate it from the rest of the accessible name that comes before it.">
|
||||
, collapsed
|
||||
</message>
|
||||
|
||||
<!-- Phone Hub tray-->
|
||||
<message name="IDS_ASH_PHONE_HUB_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the Phone Hub tray bubble for screen readers.">
|
||||
|
@ -0,0 +1 @@
|
||||
268b701b69a079dbf4524f0fa257f5f30af99fc9
|
@ -0,0 +1 @@
|
||||
5fd8393fff241325f0ea4ea820b51c33a8883988
|
@ -122,7 +122,7 @@ void ReturnToAppButtonBase::OnButtonClicked(
|
||||
app_type);
|
||||
}
|
||||
|
||||
std::u16string ReturnToAppButtonBase::GetPeripheralsAccessibleName() {
|
||||
std::u16string ReturnToAppButtonBase::GetPeripheralsAccessibleName() const {
|
||||
std::u16string tooltip_text;
|
||||
if (is_capturing_camera_) {
|
||||
tooltip_text += l10n_util::GetStringFUTF16(
|
||||
@ -144,4 +144,8 @@ std::u16string ReturnToAppButtonBase::GetPeripheralsAccessibleName() {
|
||||
return tooltip_text;
|
||||
}
|
||||
|
||||
std::u16string ReturnToAppButtonBase::GetLabelText() const {
|
||||
return label_->GetText();
|
||||
}
|
||||
|
||||
} // namespace ash::video_conference
|
||||
|
@ -59,7 +59,10 @@ class ASH_EXPORT ReturnToAppButtonBase : public views::Button {
|
||||
|
||||
// Get the text regarding the peripherals part of the return to app button
|
||||
// accessible name.
|
||||
std::u16string GetPeripheralsAccessibleName();
|
||||
std::u16string GetPeripheralsAccessibleName() const;
|
||||
|
||||
// Get the text displayed in `label_`.
|
||||
std::u16string GetLabelText() const;
|
||||
|
||||
private:
|
||||
// Indicates if the running app is using camera, microphone, or screen
|
||||
|
@ -222,25 +222,26 @@ ReturnToAppButton::ReturnToAppButton(
|
||||
is_capturing_screen,
|
||||
display_text,
|
||||
app_type),
|
||||
is_top_row_(is_top_row),
|
||||
panel_(panel) {
|
||||
auto spacing = is_top_row ? kReturnToAppButtonTopRowSpacing / 2
|
||||
: kReturnToAppButtonSpacing / 2;
|
||||
auto spacing = is_top_row_ ? kReturnToAppButtonTopRowSpacing / 2
|
||||
: kReturnToAppButtonSpacing / 2;
|
||||
SetLayoutManager(std::make_unique<views::FlexLayout>())
|
||||
->SetOrientation(views::LayoutOrientation::kHorizontal)
|
||||
.SetMainAxisAlignment(is_top_row ? views::LayoutAlignment::kCenter
|
||||
: views::LayoutAlignment::kStart)
|
||||
.SetMainAxisAlignment(is_top_row_ ? views::LayoutAlignment::kCenter
|
||||
: views::LayoutAlignment::kStart)
|
||||
.SetCrossAxisAlignment(views::LayoutAlignment::kStretch)
|
||||
.SetDefault(views::kMarginsKey, gfx::Insets::TLBR(0, spacing, 0, spacing))
|
||||
.SetInteriorMargin(gfx::Insets::TLBR(0, kReturnToAppPanelSidePadding, 0,
|
||||
kReturnToAppPanelSidePadding));
|
||||
|
||||
if (!is_top_row) {
|
||||
if (!is_top_row_) {
|
||||
icons_container()->SetPreferredSize(
|
||||
gfx::Size(/*width=*/kReturnToAppIconSize * panel->max_capturing_count(),
|
||||
/*height=*/kReturnToAppIconSize));
|
||||
}
|
||||
|
||||
if (is_top_row) {
|
||||
if (is_top_row_) {
|
||||
auto expand_indicator = std::make_unique<ReturnToAppExpandButton>(this);
|
||||
expand_indicator->SetImage(ui::ImageModel::FromVectorIcon(
|
||||
kUnifiedMenuExpandIcon, cros_tokens::kCrosSysSecondary, 16));
|
||||
@ -253,12 +254,12 @@ ReturnToAppButton::ReturnToAppButton(
|
||||
icons_container()->layer()->SetFillsBoundsOpaquely(false);
|
||||
}
|
||||
|
||||
SetAccessibleName(GetPeripheralsAccessibleName() + display_text);
|
||||
UpdateAccessibleName();
|
||||
|
||||
// When we show the bubble for the first time, only the top row is visible.
|
||||
SetVisible(is_top_row);
|
||||
SetVisible(is_top_row_);
|
||||
|
||||
if (!is_top_row) {
|
||||
if (!is_top_row_) {
|
||||
// Add a layer to perform fade in animation.
|
||||
SetPaintToLayer();
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
@ -294,6 +295,8 @@ void ReturnToAppButton::OnButtonClicked(
|
||||
// For summary row, toggle the expand state.
|
||||
expanded_ = !expanded_;
|
||||
|
||||
UpdateAccessibleName();
|
||||
|
||||
for (auto& observer : observer_list_) {
|
||||
observer.OnExpandedStateChanged(expanded_);
|
||||
}
|
||||
@ -311,6 +314,18 @@ void ReturnToAppButton::OnButtonClicked(
|
||||
}
|
||||
}
|
||||
|
||||
void ReturnToAppButton::UpdateAccessibleName() {
|
||||
auto accessible_name = GetPeripheralsAccessibleName() + GetLabelText();
|
||||
|
||||
if (is_top_row_) {
|
||||
accessible_name += l10n_util::GetStringUTF16(
|
||||
expanded_ ? VIDEO_CONFERENCE_RETURN_TO_APP_EXPANDED_ACCESSIBLE_NAME
|
||||
: VIDEO_CONFERENCE_RETURN_TO_APP_COLLAPSED_ACCESSIBLE_NAME);
|
||||
}
|
||||
|
||||
SetAccessibleName(accessible_name);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ReturnToAppContainer:
|
||||
|
||||
|
@ -84,9 +84,13 @@ class ASH_EXPORT ReturnToAppButton : public ReturnToAppButtonBase {
|
||||
private:
|
||||
FRIEND_TEST_ALL_PREFIXES(ReturnToAppPanelTest, ExpandCollapse);
|
||||
|
||||
void UpdateAccessibleName();
|
||||
|
||||
// Registered observers.
|
||||
base::ObserverList<Observer> observer_list_;
|
||||
|
||||
const bool is_top_row_;
|
||||
|
||||
// Indicates if this button (and also the parent panel) is in the expanded
|
||||
// state. Note that `expanded_` is only meaningful in the case that the button
|
||||
// is in the top row.
|
||||
|
@ -617,8 +617,6 @@ TEST_F(ReturnToAppPanelTest, ReturnToAppButtonAccessibleName) {
|
||||
auto* return_to_app_panel = GetReturnToAppPanel();
|
||||
auto* return_to_app_container = GetReturnToAppContainer(return_to_app_panel);
|
||||
|
||||
auto* summary_row = static_cast<ReturnToAppButton*>(
|
||||
return_to_app_container->children().front());
|
||||
auto* first_app_row =
|
||||
static_cast<ReturnToAppButton*>(return_to_app_container->children()[1]);
|
||||
auto* second_app_row =
|
||||
@ -637,14 +635,63 @@ TEST_F(ReturnToAppPanelTest, ReturnToAppButtonAccessibleName) {
|
||||
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_SCREEN_SHARE));
|
||||
|
||||
// Verify accessible name for each row.
|
||||
EXPECT_EQ(expected_camera_text + expected_microphone_text +
|
||||
expected_screen_share_text +
|
||||
l10n_util::GetStringFUTF16Int(
|
||||
IDS_ASH_VIDEO_CONFERENCE_RETURN_TO_APP_SUMMARY_TEXT, 2),
|
||||
summary_row->GetAccessibleName());
|
||||
EXPECT_EQ(expected_camera_text + u"Meet", first_app_row->GetAccessibleName());
|
||||
EXPECT_EQ(expected_microphone_text + expected_screen_share_text + u"Zoom",
|
||||
second_app_row->GetAccessibleName());
|
||||
}
|
||||
|
||||
TEST_F(ReturnToAppPanelTest, ReturnToAppButtonSummaryRowAccessibleName) {
|
||||
controller()->ClearMediaApps();
|
||||
controller()->AddMediaApp(CreateFakeMediaApp(
|
||||
/*is_capturing_camera=*/true, /*is_capturing_microphone=*/false,
|
||||
/*is_capturing_screen=*/false, /*title=*/u"Meet",
|
||||
/*url=*/kMeetTestUrl));
|
||||
controller()->AddMediaApp(CreateFakeMediaApp(
|
||||
/*is_capturing_camera=*/false, /*is_capturing_microphone=*/true,
|
||||
/*is_capturing_screen=*/true, /*title=*/u"Zoom",
|
||||
/*url=*/""));
|
||||
|
||||
LeftClickOn(toggle_bubble_button());
|
||||
auto* return_to_app_panel = GetReturnToAppPanel();
|
||||
auto* return_to_app_container = GetReturnToAppContainer(return_to_app_panel);
|
||||
|
||||
auto* summary_row = static_cast<ReturnToAppButton*>(
|
||||
return_to_app_container->children().front());
|
||||
|
||||
auto expected_camera_text = l10n_util::GetStringFUTF16(
|
||||
VIDEO_CONFERENCE_RETURN_TO_APP_PERIPHERALS_ACCESSIBLE_NAME,
|
||||
l10n_util::GetStringUTF16(VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_CAMERA));
|
||||
auto expected_microphone_text = l10n_util::GetStringFUTF16(
|
||||
VIDEO_CONFERENCE_RETURN_TO_APP_PERIPHERALS_ACCESSIBLE_NAME,
|
||||
l10n_util::GetStringUTF16(
|
||||
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_MICROPHONE));
|
||||
auto expected_screen_share_text = l10n_util::GetStringFUTF16(
|
||||
VIDEO_CONFERENCE_RETURN_TO_APP_PERIPHERALS_ACCESSIBLE_NAME,
|
||||
l10n_util::GetStringUTF16(
|
||||
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_SCREEN_SHARE));
|
||||
auto expected_button_text =
|
||||
expected_camera_text + expected_microphone_text +
|
||||
expected_screen_share_text +
|
||||
l10n_util::GetStringFUTF16Int(
|
||||
IDS_ASH_VIDEO_CONFERENCE_RETURN_TO_APP_SUMMARY_TEXT, 2);
|
||||
|
||||
EXPECT_EQ(expected_button_text +
|
||||
l10n_util::GetStringUTF16(
|
||||
VIDEO_CONFERENCE_RETURN_TO_APP_COLLAPSED_ACCESSIBLE_NAME),
|
||||
summary_row->GetAccessibleName());
|
||||
|
||||
LeftClickOn(summary_row);
|
||||
|
||||
EXPECT_EQ(expected_button_text +
|
||||
l10n_util::GetStringUTF16(
|
||||
VIDEO_CONFERENCE_RETURN_TO_APP_EXPANDED_ACCESSIBLE_NAME),
|
||||
summary_row->GetAccessibleName());
|
||||
|
||||
LeftClickOn(summary_row);
|
||||
EXPECT_EQ(expected_button_text +
|
||||
l10n_util::GetStringUTF16(
|
||||
VIDEO_CONFERENCE_RETURN_TO_APP_COLLAPSED_ACCESSIBLE_NAME),
|
||||
summary_row->GetAccessibleName());
|
||||
}
|
||||
|
||||
} // namespace ash::video_conference
|
||||
|
Reference in New Issue
Block a user