Commit 0f35e6aa authored by Mark Schillaci's avatar Mark Schillaci Committed by Commit Bot

Announce alertdialog hint on Android during dialog creation

This CL modifies the behavior of alertdialogs on Android.

With this implementation, during an ALERT event, we will now
get the hint of the alertdialog and announce it as live text.
The current implementation relies on GetInnerText, which for
an alertdialog may be empty.

Authors are encouraged to set aria-describedby on an alertdialog
to reference the alert message element in the dialog. This
description will appear as a hint in GetHint, and so would be
announced with this change.

In the case that a page author does not include the hint, we
will still check GetInnerText as a potential fallback case.


Bug: 1114895
AX-Relnotes: Announce alertdialog content on creation
Change-Id: I67fbaf86da8c2352bf90f0b8a0d43d9a8499fc8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380586
Commit-Queue: Mark Schillaci <mschillaci@google.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805529}
parent 3c751ff1
......@@ -202,9 +202,17 @@ void BrowserAccessibilityManagerAndroid::FireGeneratedEvent(
case ui::AXEventGenerator::Event::SCROLL_VERTICAL_POSITION_CHANGED:
wcax->HandleScrollPositionChanged(android_node->unique_id());
break;
case ui::AXEventGenerator::Event::ALERT:
// An alert is a special case of live region. Fall through to the
// next case to handle it.
case ui::AXEventGenerator::Event::ALERT: {
// When an alertdialog is shown, we will announce the hint, which
// (should) contain the description set by the author. If it is
// empty, then we will try GetInnerText() as a fallback.
base::string16 text = android_node->GetHint();
if (text.empty())
text = android_node->GetInnerText();
wcax->AnnounceLiveRegionText(text);
break;
}
case ui::AXEventGenerator::Event::LIVE_REGION_NODE_CHANGED: {
// This event is fired when an object appears in a live region.
// Speak its text.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment