Commit 297c73f8 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Turn off tab grid animation when Voiceover is on

When the animation is on, there is a bug where if the user swipes
left-to-right to go to the next Voiceover view during the animation,
the Voiceover cursor ends up on view from the previous tab grid page,
instead of the next tab grid page. This happens because the previous
tab grid page's views are still accessible during the animation.

To prevent this, the animation can be turned off when Voiceover is
enabled. This means that when the user selects a new tab, the views
immediately update.

Bug: 978673
Change-Id: Id4b64f391614b8719e3f5d5d2e924df7d8983123
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906348
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715239}
parent 0907aea5
......@@ -494,6 +494,9 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
self.currentPageViewController.view.accessibilityElementsHidden = YES;
_currentPage = currentPage;
self.currentPageViewController.view.accessibilityElementsHidden = NO;
// Force VoiceOver to update its accessibility element tree immediately.
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,
nil);
}
// Sets the value of |currentPage|, adjusting the position of the scroll view
......@@ -504,6 +507,14 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
// the ivar may have been set before the scroll view could be updated. Calling
// this method should always update the scroll view's offset if possible.
// When VoiceOver is running, the animation can cause state to get out of
// sync. If the user swipes right during the animation, the VoiceOver cursor
// goes to the old page, instead of the new page. See crbug.com/978673 for
// more details.
if (UIAccessibilityIsVoiceOverRunning()) {
animated = NO;
}
// If the view isn't loaded yet, just do bookkeeping on |currentPage|.
if (!self.viewLoaded) {
self.currentPage = targetPage;
......
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