Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: content/browser/accessibility/browser_accessibility_manager_win.cc

Issue 332893004: Fix bug where NVDA wouldn't enter browse mode on page load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simpler_race_fix
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/accessibility/ax_tree.cc » ('j') | ui/accessibility/ax_tree.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility_manager_win.cc
diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc
index 57989b6b15d3bba9b4eebfdc35a63063b4dbc910..984c9223268d2c549ab70460c7bc1e4b5f132d02 100644
--- a/content/browser/accessibility/browser_accessibility_manager_win.cc
+++ b/content/browser/accessibility/browser_accessibility_manager_win.cc
@@ -134,6 +134,15 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX)
return;
+ // NVDA gets confused if we focus the main document element when it hasn't
+ // finished loading and it has no children at all, so suppress that event.
+ if (event_type == ui::AX_EVENT_FOCUS &&
+ node == GetRoot() &&
+ node->PlatformChildCount() == 0 &&
+ !node->GetBoolAttribute(ui::AX_ATTR_DOC_LOADED)) {
+ return;
+ }
+
LONG event_id = EVENT_MIN;
switch (event_type) {
case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED:
@@ -221,6 +230,10 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
// object and pass it that same id, which we can use to retrieve the
// IAccessible for this node.
LONG child_id = node->ToBrowserAccessibilityWin()->unique_id_win();
+
+ // Always send a focus before a load complete.
+ if (event_type == ui::AX_EVENT_LOAD_COMPLETE)
+ MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, child_id);
aboxhall 2014/06/12 22:31:45 Why is this necessary to fix this issue? Superfici
dmazzoni 2014/06/12 23:27:22 When we get a load complete, we know the document
MaybeCallNotifyWinEvent(event_id, child_id);
}
« no previous file with comments | « no previous file | ui/accessibility/ax_tree.cc » ('j') | ui/accessibility/ax_tree.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698