File tree 1 file changed +15
-0
lines changed
src/librustdoc/html/static
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1664,6 +1664,21 @@ function defocusSearchBar() {
1664
1664
var ret_in_args = addTab ( results . in_args , query , false ) ;
1665
1665
var ret_returned = addTab ( results . returned , query , false ) ;
1666
1666
1667
+ // Navigate to the relevant tab if the current tab is empty, like in case users search
1668
+ // for "-> String". If they had selected another tab previously, they have to click on
1669
+ // it again.
1670
+ if ( ( currentTab === 0 && ret_others [ 1 ] === 0 ) ||
1671
+ ( currentTab === 1 && ret_in_args [ 1 ] === 0 ) ||
1672
+ ( currentTab === 2 && ret_returned [ 1 ] === 0 ) ) {
1673
+ if ( ret_others [ 1 ] !== 0 ) {
1674
+ currentTab = 0 ;
1675
+ } else if ( ret_in_args [ 1 ] !== 0 ) {
1676
+ currentTab = 1 ;
1677
+ } else if ( ret_returned [ 1 ] !== 0 ) {
1678
+ currentTab = 2 ;
1679
+ }
1680
+ }
1681
+
1667
1682
var output = "<h1>Results for " + escape ( query . query ) +
1668
1683
( query . type ? " (type: " + escape ( query . type ) + ")" : "" ) + "</h1>" +
1669
1684
"<div id=\"titles\">" +
You can’t perform that action at this time.
0 commit comments