Commit 1152c50a authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

Add accessibility trait to popup menu cells

This CL adds the accessibility trait button to the popup menu cells.
It also adds the accessibility trait NotEnabled when the entry is
disabled.

Bug: 831290
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I4b7e91c9a7328dbc94a9c1dfff5621ba92b16164
Reviewed-on: https://chromium-review.googlesource.com/1007275
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549904}
parent b6dd9b64
......@@ -39,6 +39,7 @@ const CGFloat kMaxHeight = 100;
- (void)configureCell:(PopupMenuNavigationCell*)cell
withStyler:(ChromeTableViewStyler*)styler {
[super configureCell:cell withStyler:styler];
cell.accessibilityTraits = UIAccessibilityTraitButton;
[cell setFavicon:self.favicon];
[cell setTitle:self.title];
}
......@@ -107,6 +108,8 @@ const CGFloat kMaxHeight = 100;
[_faviconView.centerYAnchor
constraintEqualToAnchor:self.contentView.centerYAnchor]
.active = YES;
self.isAccessibilityElement = YES;
}
return self;
}
......
......@@ -52,6 +52,7 @@ const CGFloat kMaxHeight = 100;
[super configureCell:cell withStyler:styler];
cell.titleLabel.text = self.title;
cell.imageView.image = self.image;
cell.accessibilityTraits = UIAccessibilityTraitButton;
cell.userInteractionEnabled = self.enabled;
[cell setBadgeNumber:self.badgeNumber];
[cell setBadgeText:self.badgeText];
......@@ -161,6 +162,8 @@ const CGFloat kMaxHeight = 100;
constant:-kMargin];
trailingEdge.priority = UILayoutPriorityDefaultHigh - 2;
trailingEdge.active = YES;
self.isAccessibilityElement = YES;
}
return self;
}
......@@ -234,6 +237,7 @@ const CGFloat kMaxHeight = 100;
- (void)prepareForReuse {
[super prepareForReuse];
self.userInteractionEnabled = YES;
self.accessibilityTraits &= ~UIAccessibilityTraitNotEnabled;
}
- (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled {
......@@ -244,6 +248,7 @@ const CGFloat kMaxHeight = 100;
} else {
self.titleLabel.textColor = [[self class] disabledColor];
self.imageView.tintColor = [[self class] disabledColor];
self.accessibilityTraits |= UIAccessibilityTraitNotEnabled;
}
}
......
......@@ -27,8 +27,7 @@ const char kPDFURL[] = "http://ios/testing/data/http_server_files/testpage.pdf";
// Matcher for the button to find in page.
id<GREYMatcher> FindInPageButton() {
return chrome_test_util::ButtonWithAccessibilityLabel(
l10n_util::GetNSStringWithFixup(IDS_IOS_TOOLS_MENU_FIND_IN_PAGE));
return grey_accessibilityID(kToolsMenuFindInPageId);
}
} // namespace
......
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