gd: Add A11y Announcement to Welcome Dialog
Adds an announcement for screen reader users when the welcome dialog is displayed. If the screen reader isn't enabled, the announcement is ignored. Bug: b:331640291 Test: Manual testing and unit tests pass Change-Id: I01189d3b9dbb0d16ef7d0d28c422cbe6e13aa40d Demo: http://b/331640291#comment4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5446144 Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Reviewed-by: Prameet Shah <phshah@chromium.org> Reviewed-by: Cici Ruan <cuicuiruan@google.com> Commit-Queue: Gina Domergue <gdomergue@google.com> Cr-Commit-Position: refs/heads/main@{#1286202}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
deb2cca6e0
commit
4e1ba36aad
@ -7744,6 +7744,9 @@ To shut down the device, press and hold the power button on the device again.
|
||||
<message name="IDS_ASH_GAME_DASHBOARD_WELCOME_DIALOG_SHORTCUT" desc="The text displayed in the welcome dialog to show how to toggle the Game Dashboard.">
|
||||
Press <ph name="LAUNCHER_KEY_NAME">$1<ex>Launcher</ex></ph> + g at anytime
|
||||
</message>
|
||||
<message name="IDS_ASH_GAME_DASHBOARD_WELCOME_DIALOG_A11Y_ANNOUNCEMENT" desc="The announcement spoken by the screen reader when the welcome dialog is shown on screen.">
|
||||
Game Dashboard available. Press <ph name="LAUNCHER_KEY_NAME">$1<ex>Launcher</ex></ph> + Shift + Escape, then <ph name="LAUNCHER_KEY_NAME">$1<ex>Launcher</ex></ph> + g anytime to open
|
||||
</message>
|
||||
<message name="IDS_ASH_GAME_DASHBOARD_WELCOME_DIALOG_A11Y_LABEL" desc="The a11y label for the welcome dialog. Spoken by screen readers when the welcome dialog is a11y focused but not visually rendered.">
|
||||
Welcome dialog
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
f3d5a1d4106962c41de30e009cacb0b9d38c83e0
|
@ -609,6 +609,9 @@ void GameDashboardContext::MaybeShowWelcomeDialog() {
|
||||
welcome_dialog_view->StartTimer(
|
||||
base::BindOnce(&GameDashboardContext::OnWelcomeDialogTimerCompleted,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
// Once the dialog is shown, add an announcement for screen readers since the
|
||||
// dialog only shows for a short amount of time.
|
||||
welcome_dialog_view->AnnounceForAccessibility();
|
||||
}
|
||||
|
||||
void GameDashboardContext::MaybeUpdateWelcomeDialogBounds() {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/events/ash/keyboard_capability.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/border.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
@ -86,6 +87,15 @@ void GameDashboardWelcomeDialog::StartTimer(base::OnceClosure on_complete) {
|
||||
timer_.Start(FROM_HERE, kDialogDuration, std::move(on_complete));
|
||||
}
|
||||
|
||||
void GameDashboardWelcomeDialog::AnnounceForAccessibility() {
|
||||
GetViewAccessibility().AnnounceAlert(l10n_util::GetStringFUTF16(
|
||||
IDS_ASH_GAME_DASHBOARD_WELCOME_DIALOG_A11Y_ANNOUNCEMENT,
|
||||
l10n_util::GetStringUTF16(
|
||||
Shell::Get()->keyboard_capability()->HasLauncherButtonOnAnyKeyboard()
|
||||
? IDS_ASH_SHORTCUT_MODIFIER_LAUNCHER
|
||||
: IDS_ASH_SHORTCUT_MODIFIER_SEARCH)));
|
||||
}
|
||||
|
||||
// Creates a primary container that holds separate sub-containers for the text
|
||||
// and icon.
|
||||
// Note: When using `views::FlexLayoutView` it's common to wrap objects in
|
||||
|
@ -30,6 +30,10 @@ class ASH_EXPORT GameDashboardWelcomeDialog : public views::FlexLayoutView {
|
||||
// specified by `kDialogDuration` has elapsed.
|
||||
void StartTimer(base::OnceClosure on_complete);
|
||||
|
||||
// Sends an accessibility specific announcement for the screen reader. If the
|
||||
// screen reader isn't enabled, the announcement is automatically ignored.
|
||||
void AnnounceForAccessibility();
|
||||
|
||||
private:
|
||||
// Adds a stacked title/sub-label and an icon as a row to the welcome dialog.
|
||||
void AddTitleAndIconRow();
|
||||
|
Reference in New Issue
Block a user