From 2efd482e73060b867f10bad30c0ef26a31403b97 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Sat, 18 Nov 2023 02:21:45 +0100 Subject: [PATCH] Change behavior of keydown (#26677) --- htdocs/admin/ihm.php | 7 +++++++ htdocs/langs/en_US/admin.lang | 2 +- htdocs/main.inc.php | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index bc4201aa766..a7f457fe9f4 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -491,6 +491,13 @@ if ($mode == 'other') { print ''; */ + + // Show search area in top menu + print '' . $langs->trans("ShowSearchAreaInTopMenu") . ''; + print ajax_constantonoff("MAIN_USE_TOP_MENU_SEARCH_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + print ''; + print ''; + // Show bugtrack link print ''; print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc")); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8bfbff04e03..22de1d56036 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2336,7 +2336,7 @@ WebhookSetup = Webhook setup Settings = Settings WebhookSetupPage = Webhook setup page ShowQuickAddLink=Show a button to quickly add an element in top right menu - +ShowSearchAreaInTopMenu=Show the search area in the top menu HashForPing=Hash used for ping ReadOnlyMode=Is instance in "Read Only" mode DEBUGBAR_USE_LOG_FILE=Use the dolibarr.log file to trap Logs diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 94c21e89e1b..835615b4097 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2981,10 +2981,14 @@ function top_menu_search() // prevent submiting form on press ENTER jQuery("#top-global-search-input").keydown(function (e) { - if (e.keyCode == 13) { + if (e.keyCode == 13 || e.keyCode == 40) { var inputs = $(this).parents("form").eq(0).find(":button"); if (inputs[inputs.index(this) + 1] != null) { inputs[inputs.index(this) + 1].focus(); + if (e.keyCode == 13){ + inputs[inputs.index(this) + 1].trigger("click"); + } + } e.preventDefault(); return false;