         
         if didClickSearchButton {
             didClickSearchButton = false
-        } else {
+        } else if shouldSetSearchVisible {
             setSearchVisible(false, animated: shouldAnimateSearchBar)
         }
         

        guard !isAnimatingSearchBarState else {
            return false
        }
        setSearchVisible(true, animated: shouldAnimateSearchBar)
        return true
    }


    
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationBar.displayType = displayType
        title = CommonStrings.searchTitle
        if !areRecentSearchesEnabled, shouldSetTitleViewWhenRecentSearchesAreDisabled {
            navigationItem.titleView = UIView()
        }
        navigationBar.isTitleShrinkingEnabled = true
