Chromium Code Reviews| 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); |
| } |