Skip to content

Commit

Permalink
[iOS] Fix NTP animation when opening tab via keyboard
Browse files Browse the repository at this point in the history
This CL changes the order in which the BVC/the omnibox is being focused
when opening a new tab from the TabGrid using keyboard shortcut.
Previously the omnibox was focused then the BVC, leading to an
animation glitch where the omnibox and the doodle disappeared.

This CL fixes it by focusing first the BVC then runs the completion of
the animation (which contains the focus of the omnibox), letting the
animation follow its natural course.

This should be relatively safe as the only completion block passed in
the TabGrid animation is the focusing of the omnibox.
So inverting the order of the calls should only have an effect in that
case.

The launchMask isn't used when BVC is contained.

Fixed: 1096517
Change-Id: I6a53e99e5c1a598401c668390c177e4bef2fc06a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264622
Reviewed-by: Bindu Suvarna <bindusuvarna@google.com>
Commit-Queue: Bindu Suvarna <bindusuvarna@google.com>
Cr-Commit-Position: refs/branch-heads/4181@{#3}
Cr-Branched-From: c3466f0-refs/heads/master@{#781470}
  • Loading branch information
Gauthier Ambard authored and Commit Bot committed Jun 24, 2020
1 parent f35ba9d commit 999cd3f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ios/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ - (void)showTabViewController:(UIViewController*)viewController
ProceduralBlock extendedCompletion = ^{
[self.tabSwitcher.delegate
tabSwitcherDismissTransitionDidEnd:self.tabSwitcher];
if (base::FeatureList::IsEnabled(kContainedBVC)) {
[self.bvcContainer.currentBVC becomeFirstResponder];
}
if (completion) {
completion();
}
Expand All @@ -383,8 +386,6 @@ - (void)showTabViewController:(UIViewController*)viewController
toBrowser:self.bvcContainer
withCompletion:^{
extendedCompletion();
[self.bvcContainer
.currentBVC becomeFirstResponder];
}];

} else {
Expand Down

0 comments on commit 999cd3f

Please sign in to comment.