Commit 7c3264a9 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Add a11y labels for icon buttons

Bug: 769872
Change-Id: I035a4726466cca03a7e66c7d4c0562300286881a
Reviewed-on: https://chromium-review.googlesource.com/691015Reviewed-by: default avatarScott Nichols <nicholss@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505180}
parent b61fbbdf
......@@ -152,6 +152,10 @@ static const CGFloat kMoveFABAnimationTime = 0.3;
primaryImage:RemotingTheme.menuIcon
activeImage:RemotingTheme.closeIcon];
[_floatingButton addSubview:_actionImageView];
// TODO(yuweih): The accessibility label should be changed to "Close" when
// the FAB is open.
_floatingButton.accessibilityLabel =
l10n_util::GetNSString(IDS_ACTIONBAR_MENU);
[self.view addSubview:_floatingButton];
[self applyInputMode];
......
......@@ -67,6 +67,7 @@ static const int kMinPinLength = 6;
setImage:[RemotingTheme
.arrowIcon imageFlippedForRightToLeftLayoutDirection]
forState:UIControlStateNormal];
_pinButton.accessibilityLabel = l10n_util::GetNSString(IDS_CONTINUE_BUTTON);
[_pinButton setBackgroundColor:RemotingTheme.buttonBackgroundColor
forState:UIControlStateNormal];
[_pinButton setDisabledAlpha:0.7];
......
......@@ -42,11 +42,11 @@
@property(class, nonatomic, readonly) UIImage* backIcon;
@property(class, nonatomic, readonly) UIImage* checkboxCheckedIcon;
@property(class, nonatomic, readonly) UIImage* checkboxOutlineIcon;
@property(class, nonatomic, readonly) UIImage* closeIcon;
@property(class, nonatomic, readonly) UIImage* closeIcon; // ally: "Close"
@property(class, nonatomic, readonly) UIImage* desktopIcon;
@property(class, nonatomic, readonly) UIImage* feedbackIcon;
@property(class, nonatomic, readonly) UIImage* helpIcon;
@property(class, nonatomic, readonly) UIImage* menuIcon;
@property(class, nonatomic, readonly) UIImage* menuIcon; // ally: "Menu"
@property(class, nonatomic, readonly) UIImage* radioCheckedIcon;
@property(class, nonatomic, readonly) UIImage* radioOutlineIcon;
@property(class, nonatomic, readonly) UIImage* refreshIcon;
......
......@@ -8,6 +8,9 @@
#import "remoting/ios/app/remoting_theme.h"
#include "remoting/base/string_resources.h"
#include "ui/base/l10n/l10n_util.h"
@implementation RemotingTheme
#pragma mark - Colors
......@@ -232,6 +235,7 @@
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
icon = [UIImage imageNamed:@"ic_close_white"];
icon.accessibilityLabel = l10n_util::GetNSString(IDS_CLOSE);
});
return icon;
}
......@@ -250,6 +254,7 @@
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
icon = [UIImage imageNamed:@"ic_menu_white"];
icon.accessibilityLabel = l10n_util::GetNSString(IDS_ACTIONBAR_MENU);
});
return icon;
}
......
......@@ -27,6 +27,7 @@
#import "remoting/ios/app/refresh_control_provider.h"
#import "remoting/ios/app/remoting_menu_view_controller.h"
#import "remoting/ios/app/remoting_theme.h"
#import "remoting/ios/app/view_utils.h"
#import "remoting/ios/domain/client_session_details.h"
#import "remoting/ios/facade/remoting_service.h"
......@@ -128,6 +129,7 @@ ConnectionType GetConnectionType() {
style:UIBarButtonItemStyleDone
target:self
action:@selector(didSelectMenu)];
remoting::SetAccessibilityInfoFromImage(menuButton);
self.navigationItem.leftBarButtonItem = menuButton;
_appBar.headerViewController.headerView.backgroundColor =
......
......@@ -13,6 +13,7 @@
#import "remoting/ios/app/app_delegate.h"
#import "remoting/ios/app/remoting_theme.h"
#import "remoting/ios/app/settings/setting_option.h"
#import "remoting/ios/app/view_utils.h"
#include "base/logging.h"
#include "remoting/base/string_resources.h"
......@@ -61,12 +62,12 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext";
self.collectionView.backgroundColor = RemotingTheme.menuBlueColor;
// TODO(nicholss): X should be an image.
UIBarButtonItem* closeButton =
[[UIBarButtonItem alloc] initWithImage:RemotingTheme.closeIcon
style:UIBarButtonItemStyleDone
target:self
action:@selector(didTapClose:)];
remoting::SetAccessibilityInfoFromImage(closeButton);
self.navigationItem.leftBarButtonItem = nil;
self.navigationItem.rightBarButtonItem = closeButton;
......
......@@ -16,6 +16,12 @@ UIViewController* TopPresentingVC();
// guide for older OS versions that exactly matches the anchors of the view.
UILayoutGuide* SafeAreaLayoutGuideForView(UIView* view);
// Sets the a11y label of the UIBarButtonItem according to the image it holds.
void SetAccessibilityInfoFromImage(UIBarButtonItem* button);
// Sets the a11y label of the UIButton according to the image it holds.
void SetAccessibilityInfoFromImage(UIButton* button);
} // namespace remoting
#endif // REMOTING_IOS_APP_VIEW_UTILS_H_
......@@ -46,4 +46,13 @@ UILayoutGuide* SafeAreaLayoutGuideForView(UIView* view) {
}
}
void SetAccessibilityInfoFromImage(UIBarButtonItem* button) {
button.accessibilityLabel = button.image.accessibilityLabel;
}
void SetAccessibilityInfoFromImage(UIButton* button) {
button.accessibilityLabel =
[button imageForState:UIControlStateNormal].accessibilityLabel;
}
} // namespace remoting
......@@ -11,6 +11,7 @@
#import <WebKit/WebKit.h>
#import "remoting/ios/app/remoting_theme.h"
#import "remoting/ios/app/view_utils.h"
@interface WebViewController () {
NSString* _urlString;
......@@ -54,6 +55,8 @@
style:UIBarButtonItemStylePlain
target:self
action:@selector(didTapClose:)];
remoting::SetAccessibilityInfoFromImage(
self.navigationItem.leftBarButtonItem);
}
}
......
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