From acac6b04d5cbd88d87773986ffafe8dad99c2f8c 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 --- 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 6057cb8473..4189a2df1d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js +++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js @@ -59,6 +59,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.30.2