Enable accessibility tree only when VoiceOver enabled, fixes atom/atom#3288.
This commit is contained in:
parent
957de56343
commit
6bc59cf2d7
1 changed files with 10 additions and 1 deletions
|
@ -43,11 +43,20 @@
|
||||||
atom::Browser::Get()->OpenURL(base::SysNSStringToUTF8(url));
|
atom::Browser::Get()->OpenURL(base::SysNSStringToUTF8(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (bool)voiceOverEnabled {
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults addSuiteNamed:@"com.apple.universalaccess"];
|
||||||
|
[defaults synchronize];
|
||||||
|
|
||||||
|
return [defaults boolForKey:@"voiceOverOnOffKey"];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute {
|
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute {
|
||||||
// Undocumented attribute that VoiceOver happens to set while running.
|
// Undocumented attribute that VoiceOver happens to set while running.
|
||||||
// Chromium uses this too, even though it's not exactly right.
|
// Chromium uses this too, even though it's not exactly right.
|
||||||
if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) {
|
if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) {
|
||||||
[self updateAccessibilityEnabled:[value boolValue]];
|
bool enableAccessibility = ([self voiceOverEnabled] && [value boolValue]);
|
||||||
|
[self updateAccessibilityEnabled:enableAccessibility];
|
||||||
}
|
}
|
||||||
return [super accessibilitySetValue:value forAttribute:attribute];
|
return [super accessibilitySetValue:value forAttribute:attribute];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue