From 43954eb464b15d69794cc43a0f24b4d4474cf1fe Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Nov 2022 09:52:35 +0100 Subject: [PATCH] Bug 32261: Patron autocomplete - do not empty text field The jQuery UI autocomplete is supposed to replace the text field with the 'value' attribute of the selected item. As it does not exist it's emptied. We should not replace what the user typed in. Test plan: Go to the Koha home page Select "Search patrons" in the header Type 'edn', it will return 1 result Use the down key to select the item (it is not obvious but there is a little change in the color when you select the item) => Without this patch the search field is emptied => With this patch applied the search field is not modified Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jacob O'Mara --- koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js index ba4f9f9b9d..5f0aeb5559 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js +++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js @@ -61,6 +61,9 @@ function patron_autocomplete(node, options) { return on_select_callback(event, ui); } }, + focus: function( event, ui ) { + event.preventDefault(); // Don't replace the text field + }, }) .data( "ui-autocomplete" ) ._renderItem = function( ul, item ) { -- 2.39.2