Skip to content

Commit b57f508

Browse files
fix: Allow VoiceOver to navigate "back into" web contents (electron#24655)
* fix: Use ElectronAdaptedContentView * fix: Actually, nevermind, it's "BrowserAccessebilityCocoa" * chore: Remove things instead of manually keeping them
1 parent 734753d commit b57f508

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

shell/browser/ui/cocoa/electron_ns_window.mm

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,21 @@ - (id)accessibilityAttributeValue:(NSString*)attribute {
121121
if (![attribute isEqualToString:@"AXChildren"])
122122
return [super accessibilityAttributeValue:attribute];
123123

124-
// Filter out objects that aren't the title bar buttons. This has the effect
125-
// of removing the window title, which VoiceOver already sees.
124+
// We want to remove the window title (also known as
125+
// NSAccessibilityReparentingCellProxy), which VoiceOver already sees.
126126
// * when VoiceOver is disabled, this causes Cmd+C to be used for TTS but
127127
// still leaves the buttons available in the accessibility tree.
128128
// * when VoiceOver is enabled, the full accessibility tree is used.
129129
// Without removing the title and with VO disabled, the TTS would always read
130130
// the window title instead of using Cmd+C to get the selected text.
131-
NSPredicate* predicate = [NSPredicate
132-
predicateWithFormat:@"(self isKindOfClass: %@) OR (self.className == %@)",
133-
[NSButtonCell class], @"RenderWidgetHostViewCocoa"];
131+
NSPredicate* predicate =
132+
[NSPredicate predicateWithFormat:@"(self.className != %@)",
133+
@"NSAccessibilityReparentingCellProxy"];
134134

135135
NSArray* children = [super accessibilityAttributeValue:attribute];
136136
NSMutableArray* mutableChildren = [[children mutableCopy] autorelease];
137137
[mutableChildren filterUsingPredicate:predicate];
138138

139-
// We need to add the web contents: Without us doing so, VoiceOver
140-
// users will be able to navigate up the a11y tree, but not back down.
141-
// The content view contains the "web contents", which VoiceOver
142-
// immediately understands.
143-
NSView* contentView =
144-
[shell_->GetNativeWindow().GetNativeNSWindow() contentView];
145-
[mutableChildren addObject:contentView];
146-
147139
return mutableChildren;
148140
}
149141

0 commit comments

Comments
 (0)