From: Theo Julienne Date: Thu, 8 Oct 2015 22:56:26 +0000 (-0700) Subject: Enable accessibility tree only when VoiceOver enabled, fixes atom/atom#3288. X-Git-Tag: v0.33.7~8^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6bc59cf2d77d794c9533e11575e5ca1c03e3b5d8;p=electron.git Enable accessibility tree only when VoiceOver enabled, fixes atom/atom#3288. --- diff --git a/atom/browser/mac/atom_application.mm b/atom/browser/mac/atom_application.mm index 9eaabc41..cc9c6acc 100644 --- a/atom/browser/mac/atom_application.mm +++ b/atom/browser/mac/atom_application.mm @@ -43,11 +43,20 @@ 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 { // Undocumented attribute that VoiceOver happens to set while running. // Chromium uses this too, even though it's not exactly right. if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) { - [self updateAccessibilityEnabled:[value boolValue]]; + bool enableAccessibility = ([self voiceOverEnabled] && [value boolValue]); + [self updateAccessibilityEnabled:enableAccessibility]; } return [super accessibilitySetValue:value forAttribute:attribute]; }