From c41a1df5225a325eecae499356e8b86e6b0bacb7 Mon Sep 17 00:00:00 2001 From: Cepera Date: Mon, 13 Mar 2023 19:54:30 +0300 Subject: [PATCH] Check focus for location bar view (#17573) --- browser/brave_app_controller_mac_browsertest.mm | 1 + browser/ui/views/frame/brave_browser_view.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/brave_app_controller_mac_browsertest.mm b/browser/brave_app_controller_mac_browsertest.mm index 80deb68ffd35..d77acc79278a 100644 --- a/browser/brave_app_controller_mac_browsertest.mm +++ b/browser/brave_app_controller_mac_browsertest.mm @@ -41,6 +41,7 @@ BraveBrowserView* browser_view = static_cast( BraveBrowserView::GetBrowserViewForBrowser(browser())); OmniboxView* omnibox_view = browser_view->GetLocationBar()->GetOmniboxView(); + omnibox_view->SetFocus(true); omnibox_view->SelectAll(false); EXPECT_TRUE(omnibox_view->IsSelectAll()); EXPECT_TRUE(BraveBrowserWindow::From(browser()->window())->HasSelectedURL()); diff --git a/browser/ui/views/frame/brave_browser_view.cc b/browser/ui/views/frame/brave_browser_view.cc index b584bd5c95c2..bab736620d2f 100644 --- a/browser/ui/views/frame/brave_browser_view.cc +++ b/browser/ui/views/frame/brave_browser_view.cc @@ -387,7 +387,7 @@ speedreader::SpeedreaderBubbleView* BraveBrowserView::ShowSpeedreaderBubble( } bool BraveBrowserView::HasSelectedURL() const { - if (!GetLocationBarView()) { + if (!GetLocationBarView() || !GetLocationBarView()->HasFocus()) { return false; } auto* brave_omnibox_view =