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

Fix an issue with search results disappearing after returning from site details #24121

Merged
merged 5 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [*] Fix Reader Comments: Cells could sometimes be displayed overlapping another cell [#17653]
* [*] Fix Notifications: quote blocks in the Reply screen are not styled correctly [#13971]
* [*] Fix Notifications pointing to large threads sometimes break the app [#23993]
* [*] Fix an issue with search results disappearing after returning from site details [#24121]
* [*] Fix Reader: Opening comments is slow [#21887]
* [*] Fix an issue with comments button being disabled when shown from Comments or Notifications [#24120]
* [*] Fix unexpected "unsaved changes" notice when closing an un-edited post containing media in the experimental editor [#24102]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ final class ReaderSearchViewController: UIViewController {
private var currentChildVC: UIViewController?
private var previousSearchTopic: ReaderAbstractTopic?
private let contextManager = ContextManager.shared
private var isFirstAppearance = true

public override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -62,8 +63,11 @@ final class ReaderSearchViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

DispatchQueue.main.async {
self.searchController.searchBar.becomeFirstResponder()
if isFirstAppearance {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is isMovingToParent applicable here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I trust viewDidAppear(_ animated: Bool) and isFirstAppearance more.

isFirstAppearance = false
DispatchQueue.main.async {
self.searchController.searchBar.becomeFirstResponder()
}
}
}

Expand Down Expand Up @@ -222,7 +226,9 @@ extension ReaderSearchViewController: UISearchBarDelegate {
}

public func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
showSearchSuggestions()
if (searchBar.text ?? "").isEmpty {
showSearchSuggestions()
}
}

public func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
Expand Down