focus-mode: Update the a11y for the playlist button
We will update the a11y name for the button and add a description for it to indicate if it's selected or not. Bug: b/355303643 Test: Manual Change-Id: I32f05d525e08389fddef9673fada0f70ed3e776f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5758181 Reviewed-by: Sean Kau <skau@chromium.org> Commit-Queue: Hongyu Long <hongyulong@chromium.org> Reviewed-by: Richard Chui <richui@chromium.org> Cr-Commit-Position: refs/heads/main@{#1336710}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
de351fd416
commit
57fff1dab1
@ -817,6 +817,15 @@ Style notes:
|
||||
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_OFFLINE_LABEL_TWO" desc="The text shown to the user in the second line of the sounds view when they are offline.">
|
||||
Check your connection and try again.
|
||||
</message>
|
||||
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_ACCESSIBLE_NAME" desc="The accessible name for a playlist image button on the focus panel">
|
||||
Playlist: <ph name="PLAYLIST_TITLE">$1<ex>Nature</ex></ph>
|
||||
</message>
|
||||
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_SELECTED_ACCESSIBLE_DESCRIPTION" desc="The accessible description for a selected playlist image button on the focus panel">
|
||||
Selected
|
||||
</message>
|
||||
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_UNSELECTED_ACCESSIBLE_DESCRIPTION" desc="The accessible description for a unselected playlist image button on the focus panel">
|
||||
Unselected
|
||||
</message>
|
||||
<message name="IDS_ASH_STATUS_TRAY_FOCUS_MODE_DO_NOT_DISTURB" desc="The label text shown on the left side of do not disturb button in Focus mode settings panel.">
|
||||
Do Not Disturb while in Focus
|
||||
</message>
|
||||
|
1
ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_ACCESSIBLE_NAME.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_ACCESSIBLE_NAME.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
a14f7fc3bbcf1340c041a92a51122302ba3587fa
|
1
ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_SELECTED_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_SELECTED_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
7e40b06e9bb47519dab8a4193ec504b82aaef126
|
1
ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_UNSELECTED_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_UNSELECTED_ACCESSIBLE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
f6d879d83ac5f85fb17bb73cd3a3a52f3861256f
|
@ -6,10 +6,13 @@
|
||||
|
||||
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/rounded_rect_cutout_path_builder.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/controls/animated_image_view.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
|
||||
@ -117,6 +120,14 @@ void PlaylistImageButton::SetIsSelected(bool is_selected) {
|
||||
}
|
||||
image_view_->SetClipPath(builder.Build());
|
||||
|
||||
// Update the accessible description for this view once the selected state
|
||||
// changed.
|
||||
GetViewAccessibility().SetDescription(l10n_util::GetStringUTF16(
|
||||
is_selected
|
||||
? IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_SELECTED_ACCESSIBLE_DESCRIPTION
|
||||
: IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_UNSELECTED_ACCESSIBLE_DESCRIPTION));
|
||||
NotifyAccessibilityEvent(ax::mojom::Event::kStateChanged, true);
|
||||
|
||||
OnPropertyChanged(&is_selected_, views::kPropertyEffectsPaint);
|
||||
}
|
||||
|
||||
|
@ -6,12 +6,14 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/typography.h"
|
||||
#include "ash/system/focus_mode/focus_mode_controller.h"
|
||||
#include "ash/system/focus_mode/focus_mode_util.h"
|
||||
#include "ash/system/focus_mode/sounds/focus_mode_sounds_controller.h"
|
||||
#include "ash/system/focus_mode/sounds/playlist_image_button.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
@ -99,7 +101,10 @@ void PlaylistView::UpdateContents(
|
||||
title_label_->SetTooltipText(text);
|
||||
title_label_->GetViewAccessibility().SetName(text);
|
||||
playlist_image_button_->SetTooltipText(text);
|
||||
playlist_image_button_->GetViewAccessibility().SetName(text);
|
||||
playlist_image_button_->GetViewAccessibility().SetName(
|
||||
l10n_util::GetStringFUTF16(
|
||||
IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_PLAYLIST_ACCESSIBLE_NAME,
|
||||
text));
|
||||
}
|
||||
playlist_image_button_->UpdateContents(playlist_data_.thumbnail);
|
||||
}
|
||||
|
Reference in New Issue
Block a user