From 8ba1e7f0e980ab2366ee6df9d5c8ecedf1f68406 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 --- 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 ba4f9f9b9d9..5f0aeb55592 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.25.1