0

Notify the state of the drag handle with Chromevox when focusing on it

Previously with the Chromevox a11y is on, there is no announcement that
mentions the state of the shelf apps when the drag handle is focus,
that is, the users won't know if the apps in the hotseat is shown or
hidden. This cl adds additional states to the drag handle view so that
it can announce if the shelf apps are showing or not.

Bug: b:261648688
Change-Id: I8a64f10329d79f639a0ba288411f068dd9a40576
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4104481
Commit-Queue: Wen-Chien Wang <wcwang@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1083499}
This commit is contained in:
Wen-Chien Wang
2022-12-15 01:48:39 +00:00
committed by Chromium LUCI CQ
parent d8bcb76669
commit 2c8b87cb57
5 changed files with 14 additions and 10 deletions

@ -927,11 +927,8 @@ Style notes:
<message name="IDS_ASH_DRAG_HANDLE_NUDGE" desc="The text shown to users above the drag handle when the device is in tablet mode and showing the in-app shelf. Instructs them that they can transition to home screen by swiping up from the shelf.">
Swipe up to go home
</message>
<message name="IDS_ASH_DRAG_HANDLE_HOTSEAT_SHOW_ACCESSIBLE_NAME" desc="The tooltip text indicate that users can use this as a button to show the hotseat/apps in shelf bar.">
Show apps in shelf
</message>
<message name="IDS_ASH_DRAG_HANDLE_HOTSEAT_HIDE_ACCESSIBLE_NAME" desc="The tooltip text indicate that users can use this as a button to hide the hotseat/apps in shelf bar.">
Hide apps in shelf
<message name="IDS_ASH_DRAG_HANDLE_HOTSEAT_ACCESSIBLE_NAME" desc="The tooltip text indicates that users can use this as a button to show and hide the hotseat/apps in shelf bar.">
Apps in shelf
</message>
<message name="IDS_ASH_HOME_TO_OVERVIEW_CONTEXTUAL_NUDGE" desc="Text shown to the user below shelf on the home screen in tablet mode, instructing them that they can transition to overview UI by swiping up from the shelf and holding.">
Swipe up and hold to see open apps

@ -0,0 +1 @@
d3de135c53eee71fa22e9f07c06f74e32427161e

@ -1 +0,0 @@
92f122ec19a7711bc4b22e9b932cb50ecda12179

@ -1 +0,0 @@
a96c02783d2106540870bccafaef785cd7d95c99

@ -4,6 +4,8 @@
#include "ash/shelf/drag_handle.h"
#include <string>
#include "ash/accessibility/accessibility_controller_impl.h"
#include "ash/constants/ash_features.h"
#include "ash/controls/contextual_tooltip.h"
@ -272,7 +274,9 @@ gfx::Rect DragHandle::GetAnchorBoundsInScreen() const {
}
void DragHandle::GetAccessibleNodeData(ui::AXNodeData* node_data) {
// TODO(b/262424972): Remove unwanted ", window" string from the announcement.
Button::GetAccessibleNodeData(node_data);
GetViewAccessibility().OverrideRole(ax::mojom::Role::kPopUpButton);
std::u16string accessible_name = std::u16string();
switch (shelf_->shelf_layout_manager()->hotseat_state()) {
@ -282,7 +286,8 @@ void DragHandle::GetAccessibleNodeData(ui::AXNodeData* node_data) {
break;
case HotseatState::kHidden:
accessible_name = l10n_util::GetStringUTF16(
IDS_ASH_DRAG_HANDLE_HOTSEAT_SHOW_ACCESSIBLE_NAME);
IDS_ASH_DRAG_HANDLE_HOTSEAT_ACCESSIBLE_NAME);
node_data->AddState(ax::mojom::State::kCollapsed);
// When the hotseat is kHidden, the focus traversal should go to the
// status area as the next focus and the navigation area as the previous
@ -292,6 +297,8 @@ void DragHandle::GetAccessibleNodeData(ui::AXNodeData* node_data) {
shelf_->shelf_widget()->navigation_widget());
break;
case HotseatState::kExtended:
node_data->AddState(ax::mojom::State::kExpanded);
// When the hotseat is kExtended, the focus traversal should go to the
// hotseat as both the next and previous focus.
GetViewAccessibility().OverrideNextFocus(shelf_->hotseat_widget());
@ -299,9 +306,10 @@ void DragHandle::GetAccessibleNodeData(ui::AXNodeData* node_data) {
// The name should be empty when the hotseat is extended but we cannot
// hide it.
if (force_show_hotseat_resetter_)
if (force_show_hotseat_resetter_) {
accessible_name = l10n_util::GetStringUTF16(
IDS_ASH_DRAG_HANDLE_HOTSEAT_HIDE_ACCESSIBLE_NAME);
IDS_ASH_DRAG_HANDLE_HOTSEAT_ACCESSIBLE_NAME);
}
break;
}
node_data->SetName(accessible_name);