Fix search drop down

This commit is contained in:
ATM john 2021-06-19 16:56:08 +02:00
parent ad105e97d1
commit 8cc2cec560
2 changed files with 22 additions and 3 deletions

View File

@ -2565,7 +2565,7 @@ function top_menu_search()
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Search').' ('.$langs->trans('SearchMenuShortCut').')"> <a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Search').' ('.$langs->trans('SearchMenuShortCut').')">
<i class="fa fa-search" ></i> <i class="fa fa-search" ></i>
</a> </a>
<div class="dropdown-search"> <div class="dropdown-menu dropdown-search">
'.$dropDownHtml.' '.$dropDownHtml.'
</div> </div>
</div>'; </div>';
@ -2587,6 +2587,26 @@ function top_menu_search()
} }
}); });
// arrow key nav
$(document).keydown(function(e) {
// Get the focused element:
var $focused = $(":focus");
if($focused.length && $focused.hasClass("global-search-item")){
// UP - move to the previous line
if (e.keyCode == 38) {
e.preventDefault();
$focused.prev().focus();
}
// DOWN - move to the next line
if (e.keyCode == 40) {
e.preventDefault();
$focused.next().focus();
}
}
});
// submit form action // submit form action
$(".dropdown-global-search-button-list .global-search-item").on("click", function(event) { $(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
@ -2619,7 +2639,6 @@ function top_menu_search()
var openGlobalSearchDropDown = function() { var openGlobalSearchDropDown = function() {
event.preventDefault();
$("#topmenu-global-search-dropdown").toggleClass("open"); $("#topmenu-global-search-dropdown").toggleClass("open");
$("#top-global-search-input").focus(); $("#top-global-search-input").focus();
} }

View File

@ -392,7 +392,7 @@ a.top-menu-dropdown-link {
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 16px 16px; background-size: 16px 16px;
background-position: 95% center; background-position: 95% center;
border-radius: 10px; border-radius: 20px;
border: 1px solid #c4c4c2 !important; border: 1px solid #c4c4c2 !important;
transition: all 250ms ease-in-out; transition: all 250ms ease-in-out;
backface-visibility: hidden; backface-visibility: hidden;