From 17aeafad1f2dbac072f0abfc1d9caf29c77e1d37 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Wed, 26 Feb 2020 11:18:02 -0800 Subject: [PATCH] fix: Add ContentsView to AXChildren --- shell/browser/ui/cocoa/electron_ns_window.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shell/browser/ui/cocoa/electron_ns_window.mm b/shell/browser/ui/cocoa/electron_ns_window.mm index ae11246e48adf..c2248267fb11e 100644 --- a/shell/browser/ui/cocoa/electron_ns_window.mm +++ b/shell/browser/ui/cocoa/electron_ns_window.mm @@ -121,7 +121,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 {