@@ -264,6 +264,10 @@ prefix.addEventListener('keydown', function (e) {
264
264
// User pressed Down arrow, Up arrow, Left arrow, Right arrow, or Enter
265
265
// This is needed to prevent processing in the keyup event : https://stackoverflow.com/questions/9951274
266
266
keyPressHandled = true ;
267
+ if ( / E n t e r / . test ( e . key ) ) {
268
+ // Don't refresh the page if Enter is pressed even before any search results are selected
269
+ e . preventDefault ( ) ;
270
+ }
267
271
var activeElement = document . querySelector ( '#articleList .hover' ) || document . querySelector ( '#articleList a' ) ;
268
272
if ( ! activeElement ) return ;
269
273
// If user presses Enter or Right arrow, read the dirEntry or open snippet
@@ -276,6 +280,7 @@ prefix.addEventListener('keydown', function (e) {
276
280
// Open the snippet container
277
281
uiUtil . toggleSnippet ( activeElement ) ;
278
282
}
283
+ // Allow left/right arrow keys to move around in search text box when not opening snippet
279
284
return ;
280
285
}
281
286
e . preventDefault ( ) ;
@@ -5087,8 +5092,12 @@ function populateListOfArticles (dirEntryArray, reportingSearch) {
5087
5092
if ( dirEntry . snippet ) {
5088
5093
dirEntryTitle = '<strong>' + dirEntryTitle + '</strong>' ;
5089
5094
}
5095
+ let classAttribute = 'list-group-item' ;
5096
+ if ( i === 0 ) {
5097
+ classAttribute += ' hover' ;
5098
+ }
5090
5099
articleListDivHtml += '<a href="#" dirEntryId="' + dirEntryStringId +
5091
- '" class="list-group-item " role="option">' + ( reportingSearch . searchUrlIndex ? dirEntry . namespace + '/' + dirEntry . url : '' + dirEntryTitle ) + '</a>' ;
5100
+ '" class="' + classAttribute + ' " role="option">' + ( reportingSearch . searchUrlIndex ? dirEntry . namespace + '/' + dirEntry . url : '' + dirEntryTitle ) + '</a>' ;
5092
5101
}
5093
5102
5094
5103
// Set the innerHTML once
0 commit comments