Commit 1e910c7f authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Accessibility adjustments

This CL adds a delay for the voice over announcement of the InProduct
Help tips. This delay is added to prevent the announcement to be
cancelled by the element being focused, when the tab is presented.
It also adds an accessibility label to the empty space where the omnibox
should be if the toolbar was visible.

Bug: 866936
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ia75dd56772203e39b8d0bf1e94bef9cfacd87fdd
Reviewed-on: https://chromium-review.googlesource.com/1158236
Commit-Queue: edchin <edchin@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579886}
parent 0b6e6a5a
......@@ -24,6 +24,9 @@ const NSTimeInterval kBubbleVisibilityDuration = 5.0;
// after the bubble first becomes visible.
const NSTimeInterval kBubbleEngagementDuration = 30.0;
// Delay before posting the VoiceOver notification.
const CGFloat kVoiceOverAnnouncementDelay = 1;
// The name for the histogram that tracks why a bubble was dismissed.
const char kBubbleDismissalHistogramName[] = "IOS.IPHBubbleDismissalReason";
......@@ -183,8 +186,21 @@ void LogBubbleDismissalReason(BubbleDismissalReason reason) {
repeats:NO];
if (self.voiceOverAnnouncement) {
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification,
self.voiceOverAnnouncement);
// The VoiceOverAnnouncement should be dispatched after a delay to account
// the fact that it can be presented right after a screen change (for
// example when the application or a new tab is opened). This screen change
// is changing the VoiceOver focus to focus a newly visible element. If this
// announcement is currently being read, it is cancelled. The added delay
// allows the announcement to be posted after the element is focused, so it
// is not cancelled.
dispatch_after(
dispatch_time(DISPATCH_TIME_NOW,
(int64_t)(kVoiceOverAnnouncementDelay * NSEC_PER_SEC)),
dispatch_get_main_queue(), ^{
UIAccessibilityPostNotification(
UIAccessibilityAnnouncementNotification,
self.voiceOverAnnouncement);
});
}
}
......
......@@ -362,6 +362,8 @@ const UIEdgeInsets kSearchBoxStretchInsets = {3, 3, 3, 3};
- (void)addFakeTapView {
UIButton* fakeTapButton = [[UIButton alloc] init];
fakeTapButton.translatesAutoresizingMaskIntoConstraints = NO;
fakeTapButton.accessibilityLabel =
l10n_util::GetNSString(IDS_ACCNAME_LOCATION);
[self.headerView addToolbarView:fakeTapButton];
[fakeTapButton addTarget:self
action:@selector(fakeOmniboxTapped:)
......
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