0

[a11y]: makes alert event generation consistent

In AXEventGenerator::OnAtomicUpdateFinished, we add an alert event given the presence of a role matched by ui::IsAlert.
In contrast, In AXEventGenerator::OnRoleChanged, we add an alert event matched by the kAlert role.

ui::IsAlert also matches kAlertDialog, so we missed this role in the second case.

Fix this by using ui::IsAlert in OnRoleChanged as well.

R=aleventhal@chromium.org

Change-Id: Ic2b88d2738170556cd6e474d48e149dab5744200
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6374403
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1435620}
This commit is contained in:
David Tseng
2025-03-20 12:44:15 -07:00
committed by Chromium LUCI CQ
parent c7b347fe44
commit cc4c111dc2

@ -379,8 +379,7 @@ void AXEventGenerator::OnRoleChanged(AXTree* tree,
ax::mojom::Role old_role,
ax::mojom::Role new_role) {
DCHECK_EQ(tree_, tree);
AddEvent(node, new_role == ax::mojom::Role::kAlert ? Event::ALERT
: Event::ROLE_CHANGED);
AddEvent(node, ui::IsAlert(new_role) ? Event::ALERT : Event::ROLE_CHANGED);
}
void AXEventGenerator::OnIgnoredChanged(AXTree* tree,