Skip to content

Commit 0535bfb

Browse files
scottamainAndroid (Google) Code Review
authored andcommitted
Merge "docs: fix a bug in the search results in which clicking a sorting tab does not open that tab until you click a tab again. This occured due to the order of events being out of order in terms of when we invoke the click() on a tab based on the search being invoked. I'm pretty sure this worked fine before, so I think this might have been introduced by a behavior change in CSE. The fix is to simply invoke the click() for a tab when the respective search results actually return using an additional callback."
2 parents 893746b + 13e4ee1 commit 0535bfb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/html/search.jd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ page.title=Search Results
6464

6565
// upon ajax search, refresh the url and search title
6666
searchControl.setSearchStartingCallback(this, function(control, searcher, query) {
67+
$("#searchTitle").html("search results for <em>" + escapeHTML(query) + "</em>");
68+
6769
// save the tab index from the hash
6870
tabIndex = location.hash.split("&t=")[1];
69-
70-
$("#searchTitle").html("search results for <em>" + escapeHTML(query) + "</em>");
7171
$.history.add('q=' + query + '&t=' + tabIndex);
72+
});
73+
74+
searchControl.setSearchCompleteCallback(this, function(control, searcher) {
7275
openTab();
7376
});
7477

0 commit comments

Comments
 (0)