Skip to content

Commit

Permalink
fix: enable basic a11y when voice control is active (#37145)
Browse files Browse the repository at this point in the history
c.f. https://chromium-review.googlesource.com/c/chromium/src/+/2680102

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
  • Loading branch information
trop[bot] and MarshallOfSound committed Feb 6, 2023
1 parent a290148 commit 14dc9a4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions shell/browser/mac/electron_application.mm
Expand Up @@ -193,6 +193,18 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
return [super accessibilitySetValue:value forAttribute:attribute];
}

- (NSAccessibilityRole)accessibilityRole {
// For non-VoiceOver AT, such as Voice Control, Apple recommends turning on
// a11y when an AT accesses the 'accessibilityRole' property. This function
// is accessed frequently so we only change the accessibility state when
// accessibility is disabled.
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
if (!ax_state->GetAccessibilityMode().has_mode(ui::kAXModeBasic.flags())) {
ax_state->AddAccessibilityModeFlags(ui::kAXModeBasic);
}
return [super accessibilityRole];
}

- (void)orderFrontStandardAboutPanel:(id)sender {
electron::Browser::Get()->ShowAboutPanel();
}
Expand Down

0 comments on commit 14dc9a4

Please sign in to comment.