From 957de56343b505d214f3276594503080a32f2f64 Mon Sep 17 00:00:00 2001 From: Theo Julienne Date: Thu, 8 Oct 2015 11:25:05 -0700 Subject: [PATCH 1/2] NSWorkspace selectFile:inFileViewerRootedAtPath: requires a non-null second argument. --- atom/common/platform_util_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/common/platform_util_mac.mm b/atom/common/platform_util_mac.mm index 1aa75effd35b..2f9e2b764236 100644 --- a/atom/common/platform_util_mac.mm +++ b/atom/common/platform_util_mac.mm @@ -20,7 +20,7 @@ void ShowItemInFolder(const base::FilePath& full_path) { DCHECK([NSThread isMainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string - inFileViewerRootedAtPath:nil]) + inFileViewerRootedAtPath:@""]) LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value(); } From 6bc59cf2d77d794c9533e11575e5ca1c03e3b5d8 Mon Sep 17 00:00:00 2001 From: Theo Julienne Date: Thu, 8 Oct 2015 15:56:26 -0700 Subject: [PATCH 2/2] Enable accessibility tree only when VoiceOver enabled, fixes atom/atom#3288. --- atom/browser/mac/atom_application.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/atom/browser/mac/atom_application.mm b/atom/browser/mac/atom_application.mm index 9eaabc410bda..cc9c6accc83d 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]; }