Commit c52dc137 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Set BVC as first responder only if there isn't one

This CL makes sure to check that there isn't a first responder before
setting BVC as first responder.
The omnibox can be the first resonder at that point when opened from
3D touch.

Fixed: 1103635
Change-Id: I901bebd33ceced169d9848ca8c785d5ef8913ca1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315035
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792180}
parent aeb08e9b
......@@ -41,6 +41,7 @@ source_set("tab_grid") {
"//ios/chrome/browser/ui/recent_tabs",
"//ios/chrome/browser/ui/recent_tabs:recent_tabs_ui",
"//ios/chrome/browser/ui/tab_grid/transitions",
"//ios/chrome/browser/ui/util",
"//ios/chrome/browser/url_loading",
"//ios/chrome/browser/web",
"//ios/chrome/browser/web_state_list",
......
......@@ -28,6 +28,7 @@
#import "ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.h"
#import "ios/chrome/browser/ui/tab_grid/transitions/tab_grid_transition_handler.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/browser/url_loading/url_loading_params.h"
#import "ios/chrome/browser/web_state_list/web_state_list.h"
......@@ -363,7 +364,11 @@
[self.tabSwitcher.delegate
tabSwitcherDismissTransitionDidEnd:self.tabSwitcher];
if (base::FeatureList::IsEnabled(kContainedBVC)) {
[self.bvcContainer.currentBVC becomeFirstResponder];
if (!GetFirstResponder()) {
// It is possible to already have a first responder (for example the
// omnibox). In that case, we don't want to mark BVC as first responder.
[self.bvcContainer.currentBVC becomeFirstResponder];
}
}
if (completion) {
completion();
......
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