Commit 7df4f1fe authored by Abigail Klein's avatar Abigail Klein Committed by Commit Bot

Fire AXNewDocumentLoadComplete rather than AXLoadComplete.

This fixes a bug where when a page loads, Voiceover focus shifts to
the main content and starts reading it, regardless of whether the
"Automatically speak the webpage" option is checked in VoiceOver Utility.
It also sometimes causes focus changes to a different window when
VoiceOver is launched. The underlying cause of this is that Voiceover
hard-coded (using Chrome and Chromium's bundle IDs) us to automatically
read the web page on an AXLoadComplete event. Webkit fires
AXNewDocumentLoadComplete events rather than AXLoadComplete, so we
adopt that here.

For a much longer explanation and how we debugged this:
https://docs.google.com/document/d/1Rn63cAf1ZVByfh2_ln9rRA388EFM2NVW3wzZo81Bw-c/edit#

AX-Relnotes: Fix a bug where when a page loads, Voiceover focus shifts
to the main content and starts reading it, regardless of whether the
"Automatically speak the webpage" option is checked in VoiceOver Utility.

Bug: 1049320
Change-Id: Icf10fbd09bd17018ffe4d3efe9b656ed790d77c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339769Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Abigail Klein <abigailbklein@google.com>
Cr-Commit-Position: refs/heads/master@{#795490}
parent 9651b882
...@@ -101,8 +101,8 @@ AccessibilityEventRecorderMac::AccessibilityEventRecorderMac( ...@@ -101,8 +101,8 @@ AccessibilityEventRecorderMac::AccessibilityEventRecorderMac(
AddNotification(@"AXInvalidStatusChanged"); AddNotification(@"AXInvalidStatusChanged");
AddNotification(@"AXLiveRegionChanged"); AddNotification(@"AXLiveRegionChanged");
AddNotification(@"AXLiveRegionCreated"); AddNotification(@"AXLiveRegionCreated");
AddNotification(@"AXLoadComplete");
AddNotification(@"AXMenuItemSelected"); AddNotification(@"AXMenuItemSelected");
AddNotification(@"AXNewDocumentLoadComplete");
AddNotification(@"AXRowCollapsed"); AddNotification(@"AXRowCollapsed");
AddNotification(@"AXRowExpanded"); AddNotification(@"AXRowExpanded");
AddNotification(NSAccessibilityFocusedUIElementChangedNotification); AddNotification(NSAccessibilityFocusedUIElementChangedNotification);
......
...@@ -69,7 +69,8 @@ enum AXTextEditType { ...@@ -69,7 +69,8 @@ enum AXTextEditType {
NSString* const NSAccessibilityAutocorrectionOccurredNotification = NSString* const NSAccessibilityAutocorrectionOccurredNotification =
@"AXAutocorrectionOccurred"; @"AXAutocorrectionOccurred";
NSString* const NSAccessibilityLayoutCompleteNotification = @"AXLayoutComplete"; NSString* const NSAccessibilityLayoutCompleteNotification = @"AXLayoutComplete";
NSString* const NSAccessibilityLoadCompleteNotification = @"AXLoadComplete"; NSString* const NSAccessibilityNewDocumentLoadCompleteNotification =
@"AXNewDocumentLoadComplete";
NSString* const NSAccessibilityInvalidStatusChangedNotification = NSString* const NSAccessibilityInvalidStatusChangedNotification =
@"AXInvalidStatusChanged"; @"AXInvalidStatusChanged";
NSString* const NSAccessibilityLiveRegionCreatedNotification = NSString* const NSAccessibilityLiveRegionCreatedNotification =
...@@ -221,18 +222,23 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent( ...@@ -221,18 +222,23 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent(
} }
break; break;
case ui::AXEventGenerator::Event::LOAD_COMPLETE: case ui::AXEventGenerator::Event::LOAD_COMPLETE:
// This notification should only be fired on the top document. // |NSAccessibilityNewDocumentLoadCompleteNotification| should only be
// Iframes should use |ax::mojom::Event::kLayoutComplete| to signify that // fired on the top document. Iframes should use
// they have finished loading. // |ax::mojom::Event::kLayoutComplete| to signify that they have finished
// loading. |NSAccessibilityNewDocumentLoadCompleteNotification| is the
// event that Webkit notifies VoiceOver that a page load has completed.
// TODO(crbug.com/1049320): Verify in MacOS 10.16 that the "Automatically
// speak the webpage" option in the VoiceOver utility is triggered upon
// observing this event.
if (IsRootTree()) { if (IsRootTree()) {
mac_notification = NSAccessibilityLoadCompleteNotification; mac_notification = NSAccessibilityNewDocumentLoadCompleteNotification;
} else { } else {
mac_notification = NSAccessibilityLayoutCompleteNotification; mac_notification = NSAccessibilityLayoutCompleteNotification;
} }
break; break;
case ui::AXEventGenerator::Event::PORTAL_ACTIVATED: case ui::AXEventGenerator::Event::PORTAL_ACTIVATED:
DCHECK(IsRootTree()); DCHECK(IsRootTree());
mac_notification = NSAccessibilityLoadCompleteNotification; mac_notification = NSAccessibilityLayoutCompleteNotification;
break; break;
case ui::AXEventGenerator::Event::INVALID_STATUS_CHANGED: case ui::AXEventGenerator::Event::INVALID_STATUS_CHANGED:
mac_notification = NSAccessibilityInvalidStatusChangedNotification; mac_notification = NSAccessibilityInvalidStatusChangedNotification;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment