Commit 344890fb authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Unfocus omnibox when long pressing NTP element

This CL makes sure that when the user long presses on an element
displayed on the NTP, we unfocus the omnibox before showing the popup
menu.

Bug: 928237
Change-Id: I271e2eb5ca0965b05cbba8f35ef8f08e8f8ba578
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1541172
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645288}
parent 86b10204
......@@ -287,6 +287,10 @@ const char kNTPHelpURL[] =
atPoint:(CGPoint)touchLocation
atIndexPath:(NSIndexPath*)indexPath
readLaterAction:(BOOL)readLaterAction {
// Unfocus the omnibox as the omnibox can disappear when choosing some
// options. See crbug.com/928237.
[self.dispatcher cancelOmniboxEdit];
ContentSuggestionsItem* suggestionsItem =
base::mac::ObjCCastStrict<ContentSuggestionsItem>(item);
......@@ -315,6 +319,11 @@ const char kNTPHelpURL[] =
if ([item isKindOfClass:[ContentSuggestionsMostVisitedActionItem class]]) {
return;
}
// Unfocus the omnibox as the omnibox can disappear when choosing some
// options. See crbug.com/928237.
[self.dispatcher cancelOmniboxEdit];
ContentSuggestionsMostVisitedItem* mostVisitedItem =
base::mac::ObjCCastStrict<ContentSuggestionsMostVisitedItem>(item);
self.alertCoordinator = [ContentSuggestionsAlertFactory
......@@ -545,11 +554,6 @@ const char kNTPHelpURL[] =
/* in_incognito */ incognito,
/* in_background */ !incognito, kCurrentTab);
params->origin_point = originPoint;
if (incognito) {
// Unfocus the omnibox if the new page should be opened in incognito to
// prevent staying stuck.
[self.dispatcher cancelOmniboxEdit];
}
_urlLoadingService->Load(params);
}
......
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