fix: hover text only working when VO enabled (#26183)
This commit is contained in:
parent
3d9d5679c5
commit
794940272b
1 changed files with 13 additions and 27 deletions
|
@ -177,38 +177,24 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
electron::Browser::Get()->OpenURL(base::SysNSStringToUTF8(url));
|
electron::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 screen reader related functionality
|
||||||
// Chromium uses this too, even though it's not exactly right.
|
// sets when running.
|
||||||
if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) {
|
if ([attribute isEqualToString:@"AXEnhancedUserInterface"] ||
|
||||||
bool enableAccessibility = ([self voiceOverEnabled] && [value boolValue]);
|
[attribute isEqualToString:@"AXManualAccessibility"]) {
|
||||||
[self updateAccessibilityEnabled:enableAccessibility];
|
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
|
||||||
} else if ([attribute isEqualToString:@"AXManualAccessibility"]) {
|
if ([value boolValue]) {
|
||||||
[self updateAccessibilityEnabled:[value boolValue]];
|
ax_state->OnScreenReaderDetected();
|
||||||
|
} else {
|
||||||
|
ax_state->DisableAccessibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
electron::Browser::Get()->OnAccessibilitySupportChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
return [super accessibilitySetValue:value forAttribute:attribute];
|
return [super accessibilitySetValue:value forAttribute:attribute];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateAccessibilityEnabled:(BOOL)enabled {
|
|
||||||
auto* ax_state = content::BrowserAccessibilityState::GetInstance();
|
|
||||||
|
|
||||||
if (enabled) {
|
|
||||||
ax_state->OnScreenReaderDetected();
|
|
||||||
} else {
|
|
||||||
ax_state->DisableAccessibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
electron::Browser::Get()->OnAccessibilitySupportChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)orderFrontStandardAboutPanel:(id)sender {
|
- (void)orderFrontStandardAboutPanel:(id)sender {
|
||||||
electron::Browser::Get()->ShowAboutPanel();
|
electron::Browser::Get()->ShowAboutPanel();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue