Commit 94aef475 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Prevent Voiceover from reading behind scrim during search

Before, when the scrim was up, dimming the results view, Voiceover
would still read the dimmed elements. Now, as part of putting up the
scrim, the table view marks all its subviews as accessibilityHidden,
so they don't appear in Voiceover. The opposite happens when the scrim
is removed.

Bug: 981343
Change-Id: Ibfb9d37f64c30f75fbe6d05633c7e6f4790f3713
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826888Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#700296}
parent 121350ee
...@@ -1287,6 +1287,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) { ...@@ -1287,6 +1287,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
// We attach our constraints to the superview because the tableView is // We attach our constraints to the superview because the tableView is
// a scrollView and it seems that we get an empty frame when attaching to it. // a scrollView and it seems that we get an empty frame when attaching to it.
AddSameConstraints(self.scrimView, self.view.superview); AddSameConstraints(self.scrimView, self.view.superview);
self.tableView.accessibilityElementsHidden = YES;
self.tableView.scrollEnabled = NO; self.tableView.scrollEnabled = NO;
[UIView animateWithDuration:kTableViewNavigationScrimFadeDuration [UIView animateWithDuration:kTableViewNavigationScrimFadeDuration
animations:^{ animations:^{
...@@ -1303,6 +1304,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) { ...@@ -1303,6 +1304,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
} }
completion:^(BOOL finished) { completion:^(BOOL finished) {
[self.scrimView removeFromSuperview]; [self.scrimView removeFromSuperview];
self.tableView.accessibilityElementsHidden = NO;
self.tableView.scrollEnabled = YES; self.tableView.scrollEnabled = YES;
}]; }];
[self setupContextBar]; [self setupContextBar];
......
...@@ -890,6 +890,7 @@ const CGFloat kButtonHorizontalPadding = 30.0; ...@@ -890,6 +890,7 @@ const CGFloat kButtonHorizontalPadding = 30.0;
// a scrollView and it seems that we get an empty frame when attaching to // a scrollView and it seems that we get an empty frame when attaching to
// it. // it.
AddSameConstraints(self.scrimView, self.view.superview); AddSameConstraints(self.scrimView, self.view.superview);
self.tableView.accessibilityElementsHidden = YES;
self.tableView.scrollEnabled = NO; self.tableView.scrollEnabled = NO;
[UIView animateWithDuration:kTableViewNavigationScrimFadeDuration [UIView animateWithDuration:kTableViewNavigationScrimFadeDuration
animations:^{ animations:^{
...@@ -909,6 +910,7 @@ const CGFloat kButtonHorizontalPadding = 30.0; ...@@ -909,6 +910,7 @@ const CGFloat kButtonHorizontalPadding = 30.0;
} }
completion:^(BOOL finished) { completion:^(BOOL finished) {
[self.scrimView removeFromSuperview]; [self.scrimView removeFromSuperview];
self.tableView.accessibilityElementsHidden = NO;
self.tableView.scrollEnabled = YES; self.tableView.scrollEnabled = YES;
}]; }];
} }
......
...@@ -245,6 +245,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -245,6 +245,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
// Shows the scrim overlay. // Shows the scrim overlay.
- (void)showScrim { - (void)showScrim {
self.tableView.accessibilityElementsHidden = YES;
self.tableView.scrollEnabled = NO; self.tableView.scrollEnabled = NO;
[self.tableView addSubview:self.scrimView]; [self.tableView addSubview:self.scrimView];
// Attach constraints to the superview because tableView is a scrollView and // Attach constraints to the superview because tableView is a scrollView and
...@@ -265,6 +266,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -265,6 +266,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
} }
completion:^(BOOL finished) { completion:^(BOOL finished) {
[self.scrimView removeFromSuperview]; [self.scrimView removeFromSuperview];
self.tableView.accessibilityElementsHidden = NO;
self.tableView.scrollEnabled = YES; self.tableView.scrollEnabled = YES;
}]; }];
} }
......
...@@ -623,6 +623,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -623,6 +623,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
// a scrollView and it seems that we get an empty frame when attaching to // a scrollView and it seems that we get an empty frame when attaching to
// it. // it.
AddSameConstraints(self.scrimView, self.view.superview); AddSameConstraints(self.scrimView, self.view.superview);
self.tableView.accessibilityElementsHidden = YES;
self.tableView.scrollEnabled = NO; self.tableView.scrollEnabled = NO;
[UIView animateWithDuration:kTableViewNavigationScrimFadeDuration [UIView animateWithDuration:kTableViewNavigationScrimFadeDuration
animations:^{ animations:^{
...@@ -641,6 +642,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -641,6 +642,7 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
} }
completion:^(BOOL finished) { completion:^(BOOL finished) {
[self.scrimView removeFromSuperview]; [self.scrimView removeFromSuperview];
self.tableView.accessibilityElementsHidden = NO;
self.tableView.scrollEnabled = YES; self.tableView.scrollEnabled = 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