File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1664,6 +1664,21 @@ function defocusSearchBar() {
16641664 var ret_in_args = addTab ( results . in_args , query , false ) ;
16651665 var ret_returned = addTab ( results . returned , query , false ) ;
16661666
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+
16671682 var output = "<h1>Results for " + escape ( query . query ) +
16681683 ( query . type ? " (type: " + escape ( query . type ) + ")" : "" ) + "</h1>" +
16691684 "<div id=\"titles\">" +
You can’t perform that action at this time.
0 commit comments