From 837ba6a3c1be676ded570a17628fa7c9121f5699 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 10 Jan 2023 18:10:43 +0000 Subject: [PATCH] Bug 32204: Check for hash before setting focus 1. Search the catalog and view a record detail page of a record with items 2. Click 'Edit items' 3. Choose one item from the list and click 'Edit' 4. The URL fragment or in-page anchor (#edititem) is appended to the end of the URL but you are not placed on it. Instead you are placed at the top of the page and must scroll down to edit the particular item. 5. Apply patch 6. Try steps 1 - 3 again, now you should be placed in the correct location (#edititem) when editing an item. Signed-off-by: David Nind Signed-off-by: Nick Clemens --- .../intranet-tmpl/prog/js/staff-global.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index dd380236fc..c452e0226f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -49,15 +49,18 @@ $.fn.selectTabByID = function (tabID) { }; $(document).ready(function() { - $('#header_search').tabs({ - create: function( e, ui ){ - ui.panel.find("input:text:first").focus(); - }, - activate: function ( e, ui ) { - ui.newPanel.find("input:text:first").focus(); - } - }); - + //check for a hash before setting focus + let hash = window.location.hash; + if ( ! hash ) { + $('#header_search').tabs({ + create: function( e, ui ){ + ui.panel.find("input:text:first").focus(); + }, + activate: function ( e, ui ) { + ui.newPanel.find("input:text:first").focus(); + } + }); + } $(".close").click(function(){ window.close(); }); $("#checkin_search form").preventDoubleFormSubmit(); -- 2.30.2