Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: ios/chrome/browser/ui/reading_list/reading_list_empty_collection_background.mm

Issue 2729553002: Add accessibility label to Reading List empty background (Closed)
Patch Set: Address comment Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/reading_list/reading_list_empty_collection_background.mm
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_empty_collection_background.mm b/ios/chrome/browser/ui/reading_list/reading_list_empty_collection_background.mm
index dff7d74b14f1fafed07a82347a4e86616596de9b..360521e98e75a5537ced87ed451e43faffea14af 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_empty_collection_background.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_empty_collection_background.mm
@@ -46,7 +46,6 @@ const CGFloat kPercentageFromTopForPosition = 0.4;
// the color). |spaceBeforeCaret| controls whether a space should be added
// between the image and the caret.
- (void)attachIconNamed:(NSString*)iconName
- accessibilityLabel:(NSString*)accessibilityLabel
toString:(NSMutableAttributedString*)instructionString
withCaret:(NSMutableAttributedString*)caret
spaceBeforeCaret:(BOOL)spaceBeforeCaret
@@ -106,18 +105,23 @@ const CGFloat kPercentageFromTopForPosition = 0.4;
NSMutableAttributedString* instructionString =
[[NSMutableAttributedString alloc] init];
+ NSString* accessibilityInstructionString = @":";
// Add the images inside the string.
if (IsCompact()) {
// If the device has a compact display the share menu is accessed from the
// toolbar menu. If it is expanded, the share menu is directly accessible.
[self attachIconNamed:kToolbarMenuIcon
- accessibilityLabel:l10n_util::GetNSString(IDS_IOS_TOOLBAR_SETTINGS)
toString:instructionString
withCaret:caret
spaceBeforeCaret:NO
offset:iconOffset
imageAttributes:textAttributes];
+
+ accessibilityInstructionString = [[accessibilityInstructionString
+ stringByAppendingString:l10n_util::GetNSString(
+ IDS_IOS_TOOLBAR_SETTINGS)]
+ stringByAppendingString:@", "];
}
// Add a space before the share icon.
@@ -127,30 +131,43 @@ const CGFloat kPercentageFromTopForPosition = 0.4;
attributes:instructionAttributes]];
[self attachIconNamed:kShareMenuIcon
- accessibilityLabel:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_SHARE)
toString:instructionString
withCaret:caret
spaceBeforeCaret:YES
offset:iconOffset
imageAttributes:textAttributes];
+ accessibilityInstructionString = [[accessibilityInstructionString
+ stringByAppendingString:l10n_util::GetNSString(
+ IDS_IOS_TOOLS_MENU_SHARE)]
+ stringByAppendingString:@", "];
+
// Add the "Read Later" string.
NSAttributedString* shareMenuAction =
[[NSAttributedString alloc] initWithString:readLater
attributes:instructionAttributes];
[instructionString appendAttributedString:shareMenuAction];
+ accessibilityInstructionString =
+ [accessibilityInstructionString stringByAppendingString:readLater];
+ // Marker
NSRange iconRange =
[[baseAttributedString string] rangeOfString:kOpenShareMarker];
DCHECK(iconRange.location != NSNotFound);
[baseAttributedString replaceCharactersInRange:iconRange
withAttributedString:instructionString];
+ NSString* accessibilityLabel =
+ l10n_util::GetNSString(IDS_IOS_READING_LIST_EMPTY_MESSAGE);
+ accessibilityLabel = [accessibilityLabel
+ stringByReplacingOccurrencesOfString:kOpenShareMarker
+ withString:accessibilityInstructionString];
// Attach to the label.
UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero];
label.attributedText = baseAttributedString;
label.numberOfLines = 0;
label.textAlignment = NSTextAlignmentCenter;
+ label.accessibilityLabel = accessibilityLabel;
[label setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addSubview:label];
@@ -165,7 +182,6 @@ const CGFloat kPercentageFromTopForPosition = 0.4;
}
- (void)attachIconNamed:(NSString*)iconName
- accessibilityLabel:(NSString*)accessibilityLabel
toString:(NSMutableAttributedString*)instructionString
withCaret:(NSMutableAttributedString*)caret
spaceBeforeCaret:(BOOL)spaceBeforeCaret
@@ -179,7 +195,6 @@ const CGFloat kPercentageFromTopForPosition = 0.4;
NSTextAttachment* toolbarIcon = [[NSTextAttachment alloc] init];
toolbarIcon.image = [[UIImage imageNamed:iconName]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
- toolbarIcon.image.accessibilityLabel = accessibilityLabel;
toolbarIcon.bounds = CGRectMake(0, iconOffset, kIconSize, kIconSize);
[instructionString
appendAttributedString:[NSAttributedString
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698