Commit d28e9756 authored by stkhapugin's avatar stkhapugin Committed by Commit Bot

Remove trailing button from voiceover when it's disabled.

This prevents the trialing button from being accessible by
voiceover when it's not enabled.

Bug: 985763
Change-Id: Ibf1e1270984c76df5c54373beb15f0f222b6ab07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713513
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Auto-Submit: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#679951}
parent 5dbd1fcc
......@@ -44,6 +44,10 @@
// |display| is NO. Will animate change if |animated| is YES.
- (void)displayBadge:(BOOL)display animated:(BOOL)animated;
// Toggles |enabled| state of the trailing button and updates accessibility
// appropriately.
- (void)enableTrailingButton:(BOOL)enabled;
// The tappable button representing the location bar.
@property(nonatomic, strong) UIButton* locationButton;
// The label displaying the current location URL.
......
......@@ -334,6 +334,11 @@ const CGFloat kButtonTrailingSpacing = 10;
[self.leadingButton displayBadge:display animated:animated];
}
- (void)enableTrailingButton:(BOOL)enabled {
self.trailingButton.enabled = enabled;
[self updateAccessibility];
}
#pragma mark - UIResponder
// This is needed for UIMenu
......@@ -380,6 +385,12 @@ const CGFloat kButtonTrailingSpacing = 10;
self.locationButton.accessibilityValue =
[NSString stringWithFormat:@"%@", self.locationLabel.text];
}
if (self.trailingButton.enabled) {
[self.accessibleElements addObject:self.trailingButton];
} else {
[self.accessibleElements removeObject:self.trailingButton];
}
}
// Returns the font size for the location label.
......
......@@ -255,7 +255,7 @@ typedef NS_ENUM(int, TrailingButtonState) {
- (void)setShareButtonEnabled:(BOOL)enabled {
_shareButtonEnabled = enabled;
if (self.trailingButtonState == kShareButton) {
self.locationBarSteadyView.trailingButton.enabled = enabled;
[self.locationBarSteadyView enableTrailingButton:enabled];
}
}
......@@ -399,8 +399,7 @@ typedef NS_ENUM(int, TrailingButtonState) {
forState:UIControlStateNormal];
self.locationBarSteadyView.trailingButton.accessibilityLabel =
l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_SHARE);
self.locationBarSteadyView.trailingButton.enabled =
self.shareButtonEnabled;
[self.locationBarSteadyView enableTrailingButton:self.shareButtonEnabled];
break;
};
case kVoiceSearchButton: {
......@@ -419,7 +418,7 @@ typedef NS_ENUM(int, TrailingButtonState) {
forState:UIControlStateNormal];
self.locationBarSteadyView.trailingButton.accessibilityLabel =
l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_VOICE_SEARCH);
self.locationBarSteadyView.trailingButton.enabled = YES;
[self.locationBarSteadyView enableTrailingButton:YES];
}
}
}
......
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