Skip to content

Commit

Permalink
Don't suppress AX events on live regions which just became unignored
Browse files Browse the repository at this point in the history
BrowserAccessibilityComWin::UpdateStep3FireEvents() returns early
on ignored nodes as well as on nodes which used to be ignored but
no longer are. Given a live region which was ignored but is now
active, returning early results in no announcement being made.

This change only returns early if the newly-unignored node is not
inside or the root of an active live region.

AX-Relnotes: Fixes bug causing some ARIA alerts to not be presented by
screen readers on Windows.

Bug: 1249045
Change-Id: If4b4f95d9cd2b10747ebe1155992732af09aff7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3452066
Reviewed-by: Daniel Libby <dlibby@microsoft.com>
Commit-Queue: Joanmarie Diggs <jdiggs@igalia.com>
Cr-Commit-Position: refs/heads/main@{#972360}
  • Loading branch information
joanmarie authored and Chromium LUCI CQ committed Feb 17, 2022
1 parent 2ecd701 commit 6504ff4
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1480,9 +1480,12 @@ void BrowserAccessibilityComWin::UpdateStep3FireEvents() {
const bool ignored = owner()->IsIgnored();

// Suppress all of these events when the node is ignored, or when the ignored
// state has changed.
if (ignored || (old_win_attributes_->ignored != ignored))
// state has changed on a node that isn't part of an active live region.
if (ignored || (old_win_attributes_->ignored != ignored &&
!owner()->GetData().IsContainedInActiveLiveRegion() &&
!owner()->GetData().IsActiveLiveRegionRoot())) {
return;
}

// The rest of the events only fire on changes, not on new objects.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
RunEventTest(FILE_PATH_LITERAL("add-alert-with-role-change.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAddAlertContent) {
RunEventTest(FILE_PATH_LITERAL("add-alert-content.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAddChild) {
RunEventTest(FILE_PATH_LITERAL("add-child.html"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ public void test_addAlertWithRoleChange() {
"add-alert-with-role-change-expected-android.txt");
}

@Test
@SmallTest
public void test_addAlertContent() {
performTest("add-alert-content.html", "add-alert-content-expected-android.txt");
}

@Test
@SmallTest
public void test_addChild() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TYPE_ANNOUNCEMENT - [Foo]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CHILDREN-CHANGED:ADD index:0 CHILD:(role=ROLE_STATIC) role=ROLE_NOTIFICATION ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-INSERT (start=0 length=11 'First alert') role=ROLE_NOTIFICATION name='Foo' ENABLED,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:ADD index:0 CHILD:(role=ROLE_PARAGRAPH) role=ROLE_NOTIFICATION ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-INSERT (start=0 length=1 '%EF%BF%BC') role=ROLE_NOTIFICATION name='Bar' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-INSERT (start=0 length=12 'Second alert') role=ROLE_PARAGRAPH name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:ADD index:0 CHILD:(role=ROLE_STATIC) role=ROLE_PARAGRAPH ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-INSERT (start=0 length=11 'Third alert') role=ROLE_PARAGRAPH name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AXLiveRegionChanged on AXGroup AXDescription='Foo'
=== Start Continuation ===
AXLiveRegionChanged on AXGroup AXDescription='Bar'
=== Start Continuation ===
AXLiveRegionChanged on AXGroup AXDescription='Baz'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
LiveRegionChanged on role=alert, name=Bar
LiveRegionChanged on role=alert, name=Baz
LiveRegionChanged on role=alert, name=Foo
LiveRegionChanged on role=alert, name=Foo
=== Start Continuation ===
LiveRegionChanged on role=alert, name=Bar
LiveRegionChanged on role=alert, name=Bar
LiveRegionChanged on role=alert, name=Baz
LiveRegionChanged on role=alert, name=Foo
=== Start Continuation ===
LiveRegionChanged on role=alert, name=Bar
LiveRegionChanged on role=alert, name=Baz
LiveRegionChanged on role=alert, name=Baz
LiveRegionChanged on role=alert, name=Foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LiveRegionChanged on role=alert, name=Foo
=== Start Continuation ===
LiveRegionChanged on role=alert, name=Bar
=== Start Continuation ===
LiveRegionChanged on role=alert, name=Baz
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
EVENT_OBJECT_LIVEREGIONCHANGED on <div#foo> role=ROLE_SYSTEM_ALERT name="Foo"
EVENT_OBJECT_SHOW on role=ROLE_SYSTEM_STATICTEXT name="First alert"
IA2_EVENT_TEXT_INSERTED on <div#foo> role=ROLE_SYSTEM_ALERT name="Foo" new_text={'First alert' start=0 end=11}
=== Start Continuation ===
EVENT_OBJECT_LIVEREGIONCHANGED on <div#bar> role=ROLE_SYSTEM_ALERT name="Bar"
EVENT_OBJECT_SHOW on <p> role=ROLE_SYSTEM_GROUPING
IA2_EVENT_TEXT_INSERTED on <div#bar> role=ROLE_SYSTEM_ALERT name="Bar" new_text={'<obj>' start=0 end=1}
=== Start Continuation ===
EVENT_OBJECT_LIVEREGIONCHANGED on <div> role=ROLE_SYSTEM_ALERT name="Baz"
EVENT_OBJECT_SHOW on role=ROLE_SYSTEM_STATICTEXT name="Third alert"
IA2_EVENT_TEXT_INSERTED on <p#baz> role=ROLE_SYSTEM_GROUPING new_text={'Third alert' start=0 end=11}
28 changes: 28 additions & 0 deletions content/test/data/accessibility/event/add-alert-content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
@WIN-DENY:EVENT_OBJECT_LOCATIONCHANGE*
@WIN-DENY:EVENT_OBJECT_REORDER*
@UIA-WIN-DENY:StructureChanged/*
-->
<!DOCTYPE html>
<html>
<body>
<div id="foo" aria-label="Foo" role="alert"></div>
<div id="bar" aria-label="Bar" role="alert"></div>
<div aria-label="Baz" role="alert">
<p id="baz"></p>
</div>
<script>
var go_passes = [
() => document.getElementById("foo").innerHTML = "First alert",
() => document.getElementById("bar").innerHTML = "<p>Second alert</p>",
() => document.getElementById("baz").innerHTML = "Third alert",
];

var current_pass = 0;
function go() {
go_passes[current_pass++].call();
return current_pass < go_passes.length;
}
</script>
</body>
</html>

0 comments on commit 6504ff4

Please sign in to comment.