0

vc-ui: Fix accessibility issue in VC settings

Fixes the following issues.
1. Focus doesn't move to the settings page after opening audio or privacy settings
2. Accessibility label for toggle menu items should mention "toggle button"

Bug: b/364391469, b/364629297
Change-Id: I3be26d1ef7f0b81ae59f6cc84542928a6547777b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5833063
Commit-Queue: Ryota Okuji <okuji@chromium.org>
Reviewed-by: Andre Le <leandre@chromium.org>
Reviewed-by: Juliana Chang <julianachang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1351197}
This commit is contained in:
Ryota Okuji
2024-09-05 02:56:33 +00:00
committed by Chromium LUCI CQ
parent 5cacea76c8
commit 961645de16
8 changed files with 20 additions and 10 deletions

@ -1818,7 +1818,7 @@ You can also use the keyboard shortcut. First, highlight text, then press <ph na
Toggle sidetone
</message>
<message name="IDS_ASH_VIDEO_CONFERENCE_PREFERENCE_STATE_ACCESSIBLE_NAME" desc="Text for screen readers describing the state of a Studio Look preference. The commas are significant as they will introduce a pause in the spoken text.">
<ph name="PREFERENCE_TITLE">$1<ex>Studio Look preference</ex></ph>, <ph name="EFFECT_NAME">$2<ex>Face retouch</ex></ph>, <ph name="STATE">$3<ex>on</ex></ph>
<ph name="PREFERENCE_TITLE">$1<ex>Studio Look preference</ex></ph>, <ph name="EFFECT_NAME">$2<ex>Face retouch</ex></ph>, toggle button, <ph name="STATE">$3<ex>on</ex></ph>
</message>
<message name="IDS_ASH_VIDEO_CONFERENCE_SETTINGS_BUTTON_TOOLTIP" desc="Tooltip for the settings button in the VC bubble which opens a menu containing the VC settings.">
Settings

@ -1 +1 @@
09450bca5073e4ddc397eada2e528e665b0066da
a0571d699ce27bf29364783c4ec2ce6994b90e22

@ -125,7 +125,8 @@ BubbleView::~BubbleView() = default;
void BubbleView::AddedToWidget() {
if (features::IsVcTrayTitleHeaderEnabled()) {
AddChildView(std::make_unique<TitleView>());
AddChildView(std::make_unique<TitleView>(base::BindOnce(
&BubbleView::CloseBubbleView, weak_factory_.GetWeakPtr())));
}
// `ReturnToAppPanel` resides in the top-level layout and isn't part of the
// scrollable area (that can't be added until the `BubbleView` officially has

@ -62,6 +62,8 @@ class ASH_EXPORT BubbleView : public TrayBubbleView {
const raw_ref<const MediaApps> media_apps_;
raw_ptr<views::View> set_camera_background_view_ = nullptr;
base::WeakPtrFactory<BubbleView> weak_factory_{this};
};
} // namespace video_conference

@ -212,7 +212,9 @@ class SettingsMenuModelAdapter : public views::MenuModelAdapter {
class SettingsButton::MenuController : public ui::SimpleMenuModel::Delegate,
public views::ContextMenuController {
public:
MenuController() = default;
explicit MenuController(base::OnceClosure close_bubble_callback)
: close_bubble_callback_(std::move(close_bubble_callback)) {}
MenuController(const MenuController&) = delete;
MenuController& operator=(const MenuController&) = delete;
~MenuController() override = default;
@ -236,9 +238,11 @@ class SettingsButton::MenuController : public ui::SimpleMenuModel::Delegate,
auto* client = Shell::Get()->system_tray_model()->client();
switch (command_id) {
case CommandId::kAudioSettings:
std::move(close_bubble_callback_).Run();
client->ShowAudioSettings();
break;
case CommandId::kPrivacySettings:
std::move(close_bubble_callback_).Run();
client->ShowPrivacyAndSecuritySettings();
break;
case CommandId::kPortraitRelighting:
@ -321,12 +325,14 @@ class SettingsButton::MenuController : public ui::SimpleMenuModel::Delegate,
std::unique_ptr<ui::SimpleMenuModel> menu_model_;
std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_;
std::unique_ptr<views::MenuRunner> menu_runner_;
base::OnceClosure close_bubble_callback_;
};
SettingsButton::SettingsButton()
SettingsButton::SettingsButton(base::OnceClosure close_bubble_callback)
: views::Button(base::BindRepeating(&SettingsButton::OnButtonActivated,
base::Unretained(this))),
context_menu_(std::make_unique<MenuController>()) {
context_menu_(
std::make_unique<MenuController>(std::move(close_bubble_callback))) {
auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>());
layout->SetOrientation(views::BoxLayout::Orientation::kHorizontal);

@ -16,7 +16,7 @@ class SettingsButton : public views::Button {
METADATA_HEADER(SettingsButton, views::Button)
public:
SettingsButton();
explicit SettingsButton(base::OnceClosure close_bubble_callback);
~SettingsButton() override;
SettingsButton(const SettingsButton&) = delete;
SettingsButton& operator=(const SettingsButton&) = delete;

@ -42,7 +42,7 @@ constexpr auto kTitleViewPadding = gfx::Insets::TLBR(16, 16, 0, 16);
} // namespace
TitleView::TitleView() {
TitleView::TitleView(base::OnceClosure close_bubble_callback) {
SetOrientation(views::LayoutOrientation::kHorizontal);
SetInsideBorderInsets(kTitleViewPadding);
SetCrossAxisAlignment(views::BoxLayout::CrossAxisAlignment::kCenter);
@ -100,7 +100,8 @@ TitleView::TitleView() {
VideoConferenceTrayController::Get()->UpdateSidetoneSupportedState();
if (features::IsVcStudioLookEnabled()) {
AddChildView(std::make_unique<SettingsButton>());
AddChildView(
std::make_unique<SettingsButton>(std::move(close_bubble_callback)));
}
}

@ -17,7 +17,7 @@ namespace ash::video_conference {
class TitleView : public views::BoxLayoutView {
METADATA_HEADER(TitleView, views::BoxLayoutView)
public:
explicit TitleView();
explicit TitleView(base::OnceClosure close_bubble_callback);
TitleView(const TitleView&) = delete;
TitleView& operator=(const TitleView&) = delete;
~TitleView() override;