File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 129129 domSearch . addEventListener ( 'input' , onSearchChange , false ) ;
130130 window . addEventListener ( 'keydown' , onWindowKeyDown , false ) ;
131131 onHashChange ( null ) ;
132+ if ( domSearch . value ) {
133+ // user started typing a search query while the page was loading
134+ curSearchIndex = - 1 ;
135+ startAsyncSearch ( ) ;
136+ }
132137 } ) ;
133138 } ) ;
134139
643648 }
644649
645650 function onHashChange ( state ) {
651+ // Use a non-null state value to prevent the window scrolling if the user goes back to this history entry.
646652 history . replaceState ( { } , "" ) ;
647653 navigate ( location . hash ) ;
648654 if ( state == null ) window . scrollTo ( { top : 0 } ) ;
649655 }
650656
651657 function onPopState ( ev ) {
652658 onHashChange ( ev . state ) ;
659+ syncDomSearch ( ) ;
653660 }
654661
655662 function navigate ( location_hash ) {
656663 updateCurNav ( location_hash ) ;
657- if ( domSearch . value !== curNavSearch ) {
658- domSearch . value = curNavSearch ;
659- }
660664 render ( ) ;
661665 if ( imFeelingLucky ) {
662666 imFeelingLucky = false ;
663667 activateSelectedResult ( ) ;
664668 }
665669 }
666670
671+ function syncDomSearch ( ) {
672+ if ( domSearch . value !== curNavSearch ) {
673+ domSearch . value = curNavSearch ;
674+ }
675+ }
676+
667677 function activateSelectedResult ( ) {
668678 if ( domSectSearchResults . classList . contains ( "hidden" ) ) {
669679 return ;
You can’t perform that action at this time.
0 commit comments