From f45e2d2075a87bcb58abd3c00d6be9e9c92367f7 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2020 14:56:20 -0400 Subject: [PATCH] fix: Add ContentsView to AXChildren (#23174) Co-authored-by: Felix Rieseberg --- shell/browser/ui/cocoa/atom_ns_window.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shell/browser/ui/cocoa/atom_ns_window.mm b/shell/browser/ui/cocoa/atom_ns_window.mm index 5eeb848a25973..81568d76b5628 100644 --- a/shell/browser/ui/cocoa/atom_ns_window.mm +++ b/shell/browser/ui/cocoa/atom_ns_window.mm @@ -120,7 +120,18 @@ - (id)accessibilityAttributeValue:(NSString*)attribute { [NSButtonCell class], @"RenderWidgetHostViewCocoa"]; NSArray* children = [super accessibilityAttributeValue:attribute]; - return [children filteredArrayUsingPredicate:predicate]; + NSMutableArray* mutableChildren = [[children mutableCopy] autorelease]; + [mutableChildren filterUsingPredicate:predicate]; + + // We need to add the web contents: Without us doing so, VoiceOver + // users will be able to navigate up the a11y tree, but not back down. + // The content view contains the "web contents", which VoiceOver + // immediately understands. + NSView* contentView = + [shell_->GetNativeWindow().GetNativeNSWindow() contentView]; + [mutableChildren addObject:contentView]; + + return mutableChildren; } - (NSString*)accessibilityTitle {