diff --git a/DuckDuckGo/BookmarksViewController.swift b/DuckDuckGo/BookmarksViewController.swift index 235afcd895..1d9055769c 100644 --- a/DuckDuckGo/BookmarksViewController.swift +++ b/DuckDuckGo/BookmarksViewController.swift @@ -1009,8 +1009,18 @@ extension BookmarksViewController: UISearchBarDelegate { } func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { + searchBar.setShowsCancelButton(false, animated: true) // Hide the Cancel button + searchBar.resignFirstResponder() finishSearching() } + + func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { + searchBar.setShowsCancelButton(true, animated: true) + } + + func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { + searchBar.setShowsCancelButton(false, animated: true) + } } extension BookmarksViewController: UISearchResultsUpdating {