scanner: Add accessible names for selected region and fine tune handles.
Add accessible names so that screen readers can convey instructions for adjusting the selected region. Bug: b:398914045, b:401066100 Change-Id: I091676e1a5d1320baf8dfcb9b07a8d08d0536e1e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6379264 Reviewed-by: Elijah Hewer <hewer@chromium.org> Reviewed-by: Min Chen <minch@chromium.org> Commit-Queue: Michelle Chen <michellegc@google.com> Cr-Commit-Position: refs/heads/main@{#1436425}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
38cb9ef8b5
commit
b205898a58
@ -6764,6 +6764,12 @@ Here are some things you can try to get started.
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_ALERT_WINDOW_RECORD" desc="Alert spoken by screen readers on recording window screen.">
|
||||
Press enter to record window: <ph name="WINDOW_TITLE">$1<ex>Text</ex></ph>
|
||||
</message>
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_SELECTED_AREA_ACCESSIBLE_NAME" desc="The accessible name of the selected region in capture mode.">
|
||||
Selected area, use arrow keys to move
|
||||
</message>
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_SELECTED_DRAG_HANDLE_ACCESSIBLE_TITLE" desc="The accessible name of a drag handle that can be used to adjust the selected region in capture mode.">
|
||||
Selected handle, use arrow keys to move
|
||||
</message>
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_ALERT_SELECT_TYPE_IMAGE" desc="Alert spoken by screen readers on selecting screenshot mode.">
|
||||
Screenshot mode selected
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
c2f78bcef81a412b272c4e71cd38d20ee928a8d1
|
1
ash/ash_strings_grd/IDS_ASH_SCREEN_CAPTURE_SELECTED_DRAG_HANDLE_ACCESSIBLE_TITLE.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_SCREEN_CAPTURE_SELECTED_DRAG_HANDLE_ACCESSIBLE_TITLE.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
f3727b727a478754098bdea6deae7463acea1a12
|
@ -25,6 +25,7 @@
|
||||
#include "ash/capture_mode/search_results_panel.h"
|
||||
#include "ash/public/cpp/shell_window_ids.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/pill_button.h"
|
||||
#include "ash/style/style_util.h"
|
||||
#include "ash/style/tab_slider_button.h"
|
||||
@ -35,6 +36,7 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "chromeos/ui/base/chromeos_ui_constants.h"
|
||||
#include "ui/base/class_property.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/events/event_constants.h"
|
||||
#include "ui/events/keycodes/keyboard_codes.h"
|
||||
@ -272,6 +274,14 @@ bool IsCaptureWindowSelectable(aura::Window* window) {
|
||||
return !IsWindowFullyOccluded(window);
|
||||
}
|
||||
|
||||
std::u16string GetA11yNameForFineTunePosition(
|
||||
FineTunePosition fine_tune_position) {
|
||||
return l10n_util::GetStringUTF16(
|
||||
fine_tune_position == FineTunePosition::kCenter
|
||||
? IDS_ASH_SCREEN_CAPTURE_SELECTED_AREA_ACCESSIBLE_NAME
|
||||
: IDS_ASH_SCREEN_CAPTURE_SELECTED_DRAG_HANDLE_ACCESSIBLE_TITLE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -657,8 +667,8 @@ void CaptureModeSessionFocusCycler::AdvanceFocus(bool reverse) {
|
||||
auto ax_virtual_view = std::make_unique<views::AXVirtualView>();
|
||||
ax_virtual_views_[fine_tune_position] = ax_virtual_view.get();
|
||||
ax_virtual_view->SetRole(ax::mojom::Role::kButton);
|
||||
// TODO(crbug.com/401066100): Add strings.
|
||||
ax_virtual_view->SetName(u"To be determined");
|
||||
ax_virtual_view->SetName(
|
||||
GetA11yNameForFineTunePosition(fine_tune_position));
|
||||
const views::AXVirtualView::AXVirtualViews& ax_virtual_children =
|
||||
ax_widget_->GetRootView()->GetViewAccessibility().virtual_children();
|
||||
CHECK_EQ(ax_virtual_children.size(), 1u);
|
||||
|
Reference in New Issue
Block a user