scanner: Add screen reader announcement when standalone app opens.
Add screen reader announcement to describe the standalone app functionality and how to use keyboard navigation. Bug: b:398914045 Change-Id: I01c3aebc23590d21689aff4b7497f7ad714d1c28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6332958 Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Commit-Queue: Michelle Chen <michellegc@google.com> Cr-Commit-Position: refs/heads/main@{#1430055}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5f51b7e550
commit
d0bf3ca4d5
@ -6727,6 +6727,9 @@ Here are some things you can try to get started.
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_ALERT_OPEN" desc="Alert spoken by screen readers on entering capture mode.">
|
||||
Capture Mode, default is <ph name="SOURCE">$1<ex>partial</ex></ph> <ph name="TYPE">$2<ex>screenshot</ex></ph>. Press tab for keyboard navigation.
|
||||
</message>
|
||||
<message name="IDS_ASH_SUNFISH_MODE_ALERT_OPEN" desc="Alert spoken by screen readers on entering a mode where users can select a region on their screen to search.">
|
||||
Select to search my screen. Press tab then space for keyboard navigation.
|
||||
</message>
|
||||
<message name="IDS_ASH_SCREEN_CAPTURE_SOURCE_FULLSCREEN" desc="Spoken by screen readers for the open alert with the source as full screen.">
|
||||
full screen
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
9bfa31030f7af942df778c372b65cb740a338d41
|
@ -386,6 +386,9 @@ class SunfishBehavior : public CaptureModeBehavior {
|
||||
const std::u16string GetCaptureLabelRegionText() const override {
|
||||
return l10n_util::GetStringUTF16(IDS_ASH_SUNFISH_CAPTURE_LABEL);
|
||||
}
|
||||
const std::string GetCaptureModeOpenAnnouncement() const override {
|
||||
return l10n_util::GetStringUTF8(IDS_ASH_SUNFISH_MODE_ALERT_OPEN);
|
||||
}
|
||||
int GetCaptureBarWidth() const override {
|
||||
// Return the height so the button is circular.
|
||||
return capture_mode::kCaptureBarHeight;
|
||||
@ -623,6 +626,30 @@ const std::u16string CaptureModeBehavior::GetCaptureLabelRegionText() const {
|
||||
: IDS_ASH_SCREEN_CAPTURE_LABEL_REGION_VIDEO_RECORD);
|
||||
}
|
||||
|
||||
const std::string CaptureModeBehavior::GetCaptureModeOpenAnnouncement() const {
|
||||
CaptureModeController* controller = CaptureModeController::Get();
|
||||
int capture_source_id;
|
||||
switch (controller->source()) {
|
||||
case CaptureModeSource::kFullscreen:
|
||||
capture_source_id = IDS_ASH_SCREEN_CAPTURE_SOURCE_FULLSCREEN;
|
||||
break;
|
||||
case CaptureModeSource::kRegion:
|
||||
capture_source_id = IDS_ASH_SCREEN_CAPTURE_SOURCE_PARTIAL;
|
||||
break;
|
||||
case CaptureModeSource::kWindow:
|
||||
capture_source_id = IDS_ASH_SCREEN_CAPTURE_SOURCE_WINDOW;
|
||||
break;
|
||||
}
|
||||
|
||||
return l10n_util::GetStringFUTF8(
|
||||
IDS_ASH_SCREEN_CAPTURE_ALERT_OPEN,
|
||||
l10n_util::GetStringUTF16(capture_source_id),
|
||||
l10n_util::GetStringUTF16(
|
||||
controller->type() == CaptureModeType::kImage
|
||||
? IDS_ASH_SCREEN_CAPTURE_TYPE_SCREENSHOT
|
||||
: IDS_ASH_SCREEN_CAPTURE_TYPE_SCREEN_RECORDING));
|
||||
}
|
||||
|
||||
std::unique_ptr<CaptureModeBarView>
|
||||
CaptureModeBehavior::CreateCaptureModeBarView() {
|
||||
return std::make_unique<NormalCaptureBarView>(this);
|
||||
|
@ -135,6 +135,10 @@ class CaptureModeBehavior {
|
||||
// a capture region phase.
|
||||
virtual const std::u16string GetCaptureLabelRegionText() const;
|
||||
|
||||
// Returns the text to be announced by a screen reader when capture mode is
|
||||
// opened with this behavior.
|
||||
virtual const std::string GetCaptureModeOpenAnnouncement() const;
|
||||
|
||||
// Creates the capture mode bar view, which might look different depending on
|
||||
// the actual type of the behavior.
|
||||
virtual std::unique_ptr<CaptureModeBarView> CreateCaptureModeBarView();
|
||||
|
@ -369,18 +369,6 @@ int GetArrowKeyPressChange(int event_flags) {
|
||||
return capture_mode::kArrowKeyboardRegionChangeDp;
|
||||
}
|
||||
|
||||
// Returns the `message_id` for the chromevox alert when capture session starts.
|
||||
int GetMessageIdForInitialCaptureSource(CaptureModeSource source) {
|
||||
switch (source) {
|
||||
case CaptureModeSource::kFullscreen:
|
||||
return IDS_ASH_SCREEN_CAPTURE_SOURCE_FULLSCREEN;
|
||||
case CaptureModeSource::kRegion:
|
||||
return IDS_ASH_SCREEN_CAPTURE_SOURCE_PARTIAL;
|
||||
default:
|
||||
return IDS_ASH_SCREEN_CAPTURE_SOURCE_WINDOW;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateFloatingPanelBoundsIfNeeded() {
|
||||
Shell::Get()->accessibility_controller()->UpdateFloatingPanelBoundsIfNeeded();
|
||||
}
|
||||
@ -3834,14 +3822,8 @@ void CaptureModeSession::InitInternal() {
|
||||
// Trigger this before creating `capture_mode_bar_widget_` as we want to read
|
||||
// out this message before reading out the first view of
|
||||
// `capture_mode_bar_widget_`.
|
||||
capture_mode_util::TriggerAccessibilityAlert(l10n_util::GetStringFUTF8(
|
||||
IDS_ASH_SCREEN_CAPTURE_ALERT_OPEN,
|
||||
l10n_util::GetStringUTF16(
|
||||
GetMessageIdForInitialCaptureSource(controller_->source())),
|
||||
l10n_util::GetStringUTF16(
|
||||
controller_->type() == CaptureModeType::kImage
|
||||
? IDS_ASH_SCREEN_CAPTURE_TYPE_SCREENSHOT
|
||||
: IDS_ASH_SCREEN_CAPTURE_TYPE_SCREEN_RECORDING)));
|
||||
capture_mode_util::TriggerAccessibilityAlert(
|
||||
active_behavior_->GetCaptureModeOpenAnnouncement());
|
||||
|
||||
// A context menu may have input capture when entering a session. Remove
|
||||
// capture from it, otherwise subsequent mouse events will cause it to close,
|
||||
|
Reference in New Issue
Block a user