diff --git a/shell/browser/ui/cocoa/electron_ns_window.mm b/shell/browser/ui/cocoa/electron_ns_window.mm index 05c9af04fe6b..8da315c8f6bd 100644 --- a/shell/browser/ui/cocoa/electron_ns_window.mm +++ b/shell/browser/ui/cocoa/electron_ns_window.mm @@ -121,29 +121,21 @@ bool ScopedDisableResize::disable_resize_ = false; if (![attribute isEqualToString:@"AXChildren"]) return [super accessibilityAttributeValue:attribute]; - // Filter out objects that aren't the title bar buttons. This has the effect - // of removing the window title, which VoiceOver already sees. + // We want to remove the window title (also known as + // NSAccessibilityReparentingCellProxy), which VoiceOver already sees. // * when VoiceOver is disabled, this causes Cmd+C to be used for TTS but // still leaves the buttons available in the accessibility tree. // * when VoiceOver is enabled, the full accessibility tree is used. // Without removing the title and with VO disabled, the TTS would always read // the window title instead of using Cmd+C to get the selected text. - NSPredicate* predicate = [NSPredicate - predicateWithFormat:@"(self isKindOfClass: %@) OR (self.className == %@)", - [NSButtonCell class], @"RenderWidgetHostViewCocoa"]; + NSPredicate* predicate = + [NSPredicate predicateWithFormat:@"(self.className != %@)", + @"NSAccessibilityReparentingCellProxy"]; NSArray* children = [super accessibilityAttributeValue:attribute]; 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; }