fix: restore accessibility window title on macOS (#21462)
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).
This commit is contained in:
parent
9e866f8315
commit
a5c9bd53e0
1 changed files with 4 additions and 2 deletions
|
@ -103,8 +103,6 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
}
|
||||
|
||||
- (id)accessibilityAttributeValue:(NSString*)attribute {
|
||||
if ([attribute isEqual:NSAccessibilityTitleAttribute])
|
||||
return base::SysUTF8ToNSString(shell_->GetTitle());
|
||||
if ([attribute isEqual:NSAccessibilityEnabledAttribute])
|
||||
return [NSNumber numberWithBool:YES];
|
||||
if (![attribute isEqualToString:@"AXChildren"])
|
||||
|
@ -125,6 +123,10 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
return [children filteredArrayUsingPredicate:predicate];
|
||||
}
|
||||
|
||||
- (NSString*)accessibilityTitle {
|
||||
return base::SysUTF8ToNSString(shell_->GetTitle());
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow {
|
||||
return !self.disableKeyOrMainWindow;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue