fix: enable basic a11y when voice control is active (#37122)

c.f. https://chromium-review.googlesource.com/c/chromium/src/+/2680102
This commit is contained in:
Samuel Attard 2023-02-06 03:32:21 -08:00 committed by GitHub
parent 9ec13afeaf
commit 7dcd97f864
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -193,6 +193,18 @@ inline void dispatch_sync_main(dispatch_block_t block) {
return [super accessibilitySetValue:value forAttribute: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 { - (void)orderFrontStandardAboutPanel:(id)sender {
electron::Browser::Get()->ShowAboutPanel(); electron::Browser::Get()->ShowAboutPanel();
} }