Skip to content

Commit cad7054

Browse files
fix: Add ContentsView to AXChildren (electron#22399)
1 parent 4c6150e commit cad7054

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

shell/browser/ui/cocoa/electron_ns_window.mm

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,18 @@ - (id)accessibilityAttributeValue:(NSString*)attribute {
121121
[NSButtonCell class], @"RenderWidgetHostViewCocoa"];
122122

123123
NSArray* children = [super accessibilityAttributeValue:attribute];
124-
return [children filteredArrayUsingPredicate:predicate];
124+
NSMutableArray* mutableChildren = [[children mutableCopy] autorelease];
125+
[mutableChildren filterUsingPredicate:predicate];
126+
127+
// We need to add the web contents: Without us doing so, VoiceOver
128+
// users will be able to navigate up the a11y tree, but not back down.
129+
// The content view contains the "web contents", which VoiceOver
130+
// immediately understands.
131+
NSView* contentView =
132+
[shell_->GetNativeWindow().GetNativeNSWindow() contentView];
133+
[mutableChildren addObject:contentView];
134+
135+
return mutableChildren;
125136
}
126137

127138
- (NSString*)accessibilityTitle {

0 commit comments

Comments
 (0)