File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 150150 addClass ( search , "hidden" ) ;
151151 removeClass ( document . getElementById ( "main" ) , "hidden" ) ;
152152 var hash = ev . newURL . slice ( ev . newURL . indexOf ( '#' ) + 1 ) ;
153+ if ( browserSupportsHistoryApi ( ) ) {
154+ history . replaceState ( hash , "" , "#" + hash ) ;
155+ }
153156 var elem = document . getElementById ( hash ) ;
154157 if ( elem ) {
155158 elem . scrollIntoView ( ) ;
15601563 } ) ;
15611564 }
15621565 } ) ;
1566+
1567+ var search_input = document . getElementsByClassName ( "search-input" ) [ 0 ] ;
1568+
1569+ if ( search_input ) {
1570+ search_input . onfocus = function ( ) {
1571+ if ( search . value !== "" ) {
1572+ addClass ( document . getElementById ( "main" ) , "hidden" ) ;
1573+ removeClass ( document . getElementById ( "search" ) , "hidden" ) ;
1574+ }
1575+ } ;
1576+ }
15631577} ( ) ) ;
15641578
15651579// Sets the focus on the search bar at the top of the page
You can’t perform that action at this time.
0 commit comments