Commit c70beeaf authored by sczs's avatar sczs Committed by Commit bot

Adds button accessibility traits to the nativeAppItem cell.

Cells will now be a single accessibility item: https://drive.google.com/open?id=0B51hlF9bHYPwNE9CZTg1dDVyYkk

VoiceOver will read the name of the App and then the switch state or "Double tap to install" string.

BUG=590064, 341403

Review-Url: https://codereview.chromium.org/2607763002
Cr-Commit-Position: refs/heads/master@{#442092}
parent c5ffc392
......@@ -73,6 +73,7 @@ UIImage* PlaceholderIcon() {
self = [super initWithFrame:frame];
if (self) {
UIView* contentView = self.contentView;
self.isAccessibilityElement = YES;
_iconImageView = [[UIImageView alloc] init];
_iconImageView.translatesAutoresizingMaskIntoConstraints = NO;
......@@ -171,21 +172,22 @@ UIImage* PlaceholderIcon() {
return [self.accessoryView accessibilityHint];
}
- (UIAccessibilityTraits)accessibilityTraits {
// Remove the "button" accessibility trait from the switch. This matches
// native switch content views such as Settings > Airplane Mode.
return
[super accessibilityTraits] |
([self.switchControl accessibilityTraits] & ~UIAccessibilityTraitButton);
}
- (NSString*)accessibilityValue {
if (self.accessoryView == self.switchControl) {
return (self.switchControl.on)
? l10n_util::GetNSString(IDS_IOS_SETTING_ON)
: l10n_util::GetNSString(IDS_IOS_SETTING_OFF);
if (self.switchControl.on) {
return [NSString
stringWithFormat:@"%@, %@", self.nameLabel.text,
l10n_util::GetNSString(IDS_IOS_SETTING_ON)];
} else {
return [NSString
stringWithFormat:@"%@, %@", self.nameLabel.text,
l10n_util::GetNSString(IDS_IOS_SETTING_OFF)];
}
return [self.accessoryView accessibilityValue];
}
return [NSString stringWithFormat:@"%@, %@", self.nameLabel.text,
l10n_util::GetNSString(
IDS_IOS_GOOGLE_APPS_INSTALL_BUTTON)];
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment