0

Virtual Desks Chromevox announcement on name view highlight.

When a user tabs into a desk name view trigger an announcement to tell
them how to edit the text.

Bug: b/247921161
Change-Id: I3924059278a7d087c84948265397d5016bfe2721
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3953640
Reviewed-by: Sammie Quon <sammiequon@chromium.org>
Commit-Queue: Andrew Pantera <andp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1060049}
This commit is contained in:
Andrew Pantera
2022-10-17 18:03:02 +00:00
committed by Chromium LUCI CQ
parent 60ab2b326f
commit 007a0c8c27
3 changed files with 17 additions and 0 deletions

@ -2078,6 +2078,9 @@ Style notes:
<message name="IDS_ASH_DESKS_CLOSE_ALL_UNDONE_NOTIFICATION" desc="ChromeVox announcement that is read when the user presses the button to undo desk removal.">
Desk and windows reopened
</message>
<message name="IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION" desc="Alert spoken by screen readers when user tabs to the name view of a virtual desk.">
Press enter or search + space to select the text for editing.
</message>
<!-- Status tray charging strings. -->
<message name="IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE" desc="The title of a notification indicating that a low-current USB charger has been connected.">

@ -0,0 +1 @@
9e5746bd25e53c3cd96c4f5be6a6cb9b19068d59

@ -6,11 +6,14 @@
#include <memory>
#include "ash/accessibility/accessibility_controller_impl.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/wm/desks/desk_mini_view.h"
#include "ash/wm/desks/desks_bar_view.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_grid.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/text_elider.h"
#include "ui/views/focus/focus_manager.h"
@ -63,6 +66,16 @@ void DeskNameView::CommitChanges(views::Widget* widget) {
}
void DeskNameView::OnViewHighlighted() {
if (!HasFocus()) {
// When the highlight is the result of tabbing, as opposed to clicking or
// chromevoxing, the name view will not have focus, so the user should be
// told how to focus and edit the field.
Shell::Get()
->accessibility_controller()
->TriggerAccessibilityAlertWithMessage(l10n_util::GetStringUTF8(
IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION));
}
DesksTextfield::OnViewHighlighted();
mini_view_->owner_bar()->ScrollToShowMiniViewIfNecessary(mini_view_);
}