File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,7 +113,13 @@ export const searchLoad = (isHome = false) => {
113113 nav . prepend ( search ) ;
114114 const showResults = ( ) =>
115115 ( input . value ? addClass : delClass ) ( results , 'show' ) ;
116- input . addEventListener ( 'focus' , showResults ) ;
116+ input . addEventListener ( 'focus' , ( ) => {
117+ // The search box sits beside the menu here, so close the menu.
118+ if ( matchMedia ( '(min-width: 38rem)' ) . matches ) {
119+ ( doc . getElementById ( 'menustate' ) as HTMLInputElement ) . checked = false ;
120+ }
121+ showResults ( ) ;
122+ } ) ;
117123 input . addEventListener ( 'input' , ( ) => {
118124 showResults ( ) ;
119125 populateResults ( ) ;
Original file line number Diff line number Diff line change @@ -201,6 +201,14 @@ body:not(.home) > header {
201201 > nav > ul {
202202 display : none ;
203203 }
204+ // Keep the search results on the screen, now the search is at the right.
205+ > nav > #search > ol {
206+ right : 0 ;
207+ }
208+ // The menu and the search results would overlap, so only show one.
209+ > #menustate :checked ~ nav > #search > ol {
210+ display : none ;
211+ }
204212 > #menustate :checked ~ nav > ul {
205213 .dropdown ();
206214 display : block ;
@@ -226,9 +234,13 @@ body:not(.home) > header {
226234 width : 100% ;
227235 max-width : unset ;
228236 }
237+ > ol .show {
238+ display : block ;
239+ }
229240 }
230241 > ul {
231242 position : static ;
243+ z-index : auto ;
232244 width : auto ;
233245 padding : 0 ;
234246 border : 0 ;
Original file line number Diff line number Diff line change 4242 z-index : 1 ;
4343 }
4444 > header {
45+ // Above the footer, so that the menu and search results can overlap it.
46+ z-index : 2 ;
4547 border-bottom : 1px solid @borderColor ;
4648 box-shadow : @shadow ;
4749 }
You can’t perform that action at this time.
0 commit comments