@@ -99,6 +99,7 @@ function SearchBox(name, resultsPath, extension)
99
99
this . searchIndex = 0 ;
100
100
this . searchActive = false ;
101
101
this . extension = extension ;
102
+ this . ignoreNextEscKeyUp = false ;
102
103
103
104
// ----------- DOM Elements
104
105
@@ -196,6 +197,11 @@ function SearchBox(name, resultsPath, extension)
196
197
else if ( e . keyCode == 27 ) // Escape out of the search field
197
198
{
198
199
e . stopPropagation ( ) ;
200
+ if ( this . ignoreNextEscKeyUp )
201
+ {
202
+ this . ignoreNextEscKeyUp = false ;
203
+ return ;
204
+ }
199
205
this . DOMSearchField ( ) . blur ( ) ;
200
206
this . DOMPopupSearchResultsWindow ( ) . style . display = 'none' ;
201
207
this . DOMSearchClose ( ) . style . display = 'none' ;
@@ -291,6 +297,10 @@ function SearchBox(name, resultsPath, extension)
291
297
else if ( e . keyCode == 13 || e . keyCode == 27 )
292
298
{
293
299
e . stopPropagation ( ) ;
300
+ if ( e . keyCode == 27 )
301
+ {
302
+ this . ignoreNextEscKeyUp = true ;
303
+ }
294
304
this . OnSelectItem ( this . searchIndex ) ;
295
305
this . CloseSelectionWindow ( ) ;
296
306
this . DOMSearchField ( ) . focus ( ) ;
@@ -304,6 +314,7 @@ function SearchBox(name, resultsPath, extension)
304
314
this . CloseResultsWindow = function ( )
305
315
{
306
316
this . DOMPopupSearchResultsWindow ( ) . style . display = 'none' ;
317
+ this . DOMPopupSearchResultsWindow ( ) . style . tabindex = '-1' ;
307
318
this . DOMSearchClose ( ) . style . display = 'none' ;
308
319
this . Activate ( false ) ;
309
320
}
@@ -820,5 +831,22 @@ function init_search()
820
831
results . appendChild ( link ) ;
821
832
}
822
833
searchBox . OnSelectItem ( 0 ) ;
834
+
835
+
836
+ var input = document . getElementById ( "MSearchSelect" ) ;
837
+ var searchSelectWindow = document . getElementById ( "MSearchSelectWindow" ) ;
838
+
839
+ input . addEventListener ( "keypress" , function ( event ) {
840
+ if ( event . key === "Enter" ) {
841
+ event . preventDefault ( ) ;
842
+ if ( searchSelectWindow . style . display == 'block' ) {
843
+ this . CloseSelectionWindow ( ) ;
844
+ this . DOMSearchField ( ) . focus ( ) ;
845
+ } else {
846
+ searchBox . OnSearchSelectShow ( ) ;
847
+ searchSelectWindow . focus ( ) ;
848
+ }
849
+ }
850
+ } ) ;
823
851
}
824
852
/* @license -end */
0 commit comments