Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix FXIOS-11279 - [Toolbar Redesign] Selecting any search suggestion doesn't open google with new tab with custom URL (backport #24611) #24631

Open
wants to merge 1 commit into
base: release/v135
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4156,7 +4156,7 @@ extension BrowserViewController: KeyboardHelperDelegate {
self.bottomContentStackView.layoutIfNeeded()
})

finishEditionMode()
cancelEditingMode()
}

func keyboardHelper(_ keyboardHelper: KeyboardHelper, keyboardDidHideWithState state: KeyboardState) {
Expand All @@ -4182,12 +4182,25 @@ extension BrowserViewController: KeyboardHelperDelegate {
})
}

private func finishEditionMode() {
private func cancelEditingMode() {
// If keyboard is dismissed leave edit mode, Homepage case is handled in HomepageVC
guard shouldCancelEditing else { return }
overlayManager.cancelEditing(shouldCancelLoading: false)
}

private var shouldCancelEditing: Bool {
let newTabChoice = NewTabAccessors.getNewTabPage(profile.prefs)
if newTabChoice != .topSites, newTabChoice != .blankPage {
overlayManager.cancelEditing(shouldCancelLoading: false)
}
guard newTabChoice != .topSites, newTabChoice != .blankPage else { return false }

guard isToolbarRefactorEnabled else { return true }

let searchTerm = store.state.screenState(
ToolbarState.self,
for: .toolbar,
window: windowUUID
)?.addressToolbar.searchTerm

return searchTerm == nil
}
}

Expand Down