Skip to content

Commit 42b4433

Browse files
trop[bot]codebytere
authored andcommitted
fix: restore accessibility window title on macOS (electron#21465)
Electron's `AtomNSWindow` implements `accessibilityAttributeValue` to provide various accessibility info to the OS, including window titles. Chromium 75 changed to Apple's newer accessibility API for window titles in the super class that `AtomNSWindow` inherits from. macOS still supports both the old and new style APIs, but it will prefer the new style if it is implemented. This means the Electron window title is being ignored because the newer API at the Chromium level has taken precedence. By implementing the newer accessibility API in `AtomNSWindow`, this restores correct accessibility window titles in macOS Electron apps. This is a regression has been present since Electron 6.0.0 (the first release including the Chromium change above).
1 parent 8c8d3d2 commit 42b4433

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

atom/browser/ui/cocoa/atom_ns_window.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ - (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews {
9999
}
100100

101101
- (id)accessibilityAttributeValue:(NSString*)attribute {
102-
if ([attribute isEqual:NSAccessibilityTitleAttribute])
103-
return base::SysUTF8ToNSString(shell_->GetTitle());
104102
if ([attribute isEqual:NSAccessibilityEnabledAttribute])
105103
return [NSNumber numberWithBool:YES];
106104
if (![attribute isEqualToString:@"AXChildren"])
@@ -121,6 +119,10 @@ - (id)accessibilityAttributeValue:(NSString*)attribute {
121119
return [children filteredArrayUsingPredicate:predicate];
122120
}
123121

122+
- (NSString*)accessibilityTitle {
123+
return base::SysUTF8ToNSString(shell_->GetTitle());
124+
}
125+
124126
- (BOOL)canBecomeMainWindow {
125127
return !self.disableKeyOrMainWindow;
126128
}

0 commit comments

Comments
 (0)