Skip to content

Commit

Permalink
Don't expose the busy state on loading pages on Windows
Browse files Browse the repository at this point in the history
crrev.com/c/3268209 introduced a regression for NVDA users:
When a page is newly-loaded, NVDA no longer announced the title
or did an automatic SayAll.

crrev.com/c/3585327 fixes the regression, but still exposes the busy
state all on documents in the process of loading. Doing this on
Windows can prevent NVDA from creating its virtual buffer during
page load.

This commit prevents the busy state from being exposed on a
document that already has content.

AX-Relnotes: Fixed regression causing newly-loaded pages from being
presented by NVDA.

(cherry picked from commit a86dd85)

Bug: 1315210
Change-Id: I0c73ef82ca29b286ceb7a628d7c47e13f93f0237
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3585368
Reviewed-by: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Daniel Libby <dlibby@microsoft.com>
Commit-Queue: Joanmarie Diggs <jdiggs@igalia.com>
Cr-Original-Commit-Position: refs/heads/main@{#995109}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3607670
Auto-Submit: Joanmarie Diggs <jdiggs@igalia.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5005@{#167}
Cr-Branched-From: 5b4d945-refs/heads/main@{#992738}
  • Loading branch information
joanmarie authored and Chromium LUCI CQ committed Apr 26, 2022
1 parent a55b53a commit 420c4cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
@@ -1,4 +1,4 @@
EVENT_OBJECT_STATECHANGE on <#document> role=ROLE_SYSTEM_DOCUMENT name="Starting title" value~=[doc-url] FOCUSED,BUSY,FOCUSABLE
EVENT_OBJECT_STATECHANGE on <#document> role=ROLE_SYSTEM_DOCUMENT name="Starting title" value~=[doc-url] FOCUSED,FOCUSABLE
=== Start Continuation ===
EVENT_OBJECT_HIDE on <p> role=ROLE_SYSTEM_GROUPING
EVENT_OBJECT_REORDER on <main> role=ROLE_SYSTEM_GROUPING
Expand Down
12 changes: 11 additions & 1 deletion ui/accessibility/platform/ax_platform_node_win.cc
Expand Up @@ -7094,6 +7094,10 @@ bool AXPlatformNodeWin::IsNameExposed() const {
}
}

bool AXPlatformNodeWin::IsPlatformDocumentWithContent() const {
return IsPlatformDocument() && GetChildCount();
}

bool AXPlatformNodeWin::IsUIAControl() const {
// UIA provides multiple "views": raw, content and control. We only want to
// populate the content and control views with items that make sense to
Expand Down Expand Up @@ -7327,8 +7331,14 @@ int AXPlatformNodeWin::MSAAState() const {
// Map the ax::mojom::State to MSAA state. Note that some of the states are
// not currently handled.

if (GetBoolAttribute(ax::mojom::BoolAttribute::kBusy))
// TODO(accessibility): https://crbug.com/1292018
// Exposing the busy state on the root web area means the NVDA user will end
// up without a virtualBuffer until the page fully loads. So if we have
// content, don't expose the busy state.
if (GetBoolAttribute(ax::mojom::BoolAttribute::kBusy) &&
!IsPlatformDocumentWithContent()) {
msaa_state |= STATE_SYSTEM_BUSY;
}

if (HasState(ax::mojom::State::kCollapsed))
msaa_state |= STATE_SYSTEM_COLLAPSED;
Expand Down
2 changes: 2 additions & 0 deletions ui/accessibility/platform/ax_platform_node_win.h
Expand Up @@ -1282,6 +1282,8 @@ class AX_EXPORT __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2"))
int GetAnnotationTypeImpl() const;
void AugmentNameWithImageAnnotationIfApplicable(std::wstring* name) const;

bool IsPlatformDocumentWithContent() const;

// Get the value attribute as a Bstr, this means something different depending
// on the type of element being queried. (e.g. kColorWell uses kColorValue).
static BSTR GetValueAttributeAsBstr(AXPlatformNodeWin* target);
Expand Down

0 comments on commit 420c4cc

Please sign in to comment.