From ab66d06f96230f511c55af2cc1f8dc9bff733696 Mon Sep 17 00:00:00 2001 From: Katariina Pohto Date: Thu, 23 May 2024 17:24:05 +0300 Subject: [PATCH] Bug 36949: Cataloguing error links don't scroll to correct position when tab changes During cataloging if there are errors in the marc fields when trying to save a record, the error links don't always scroll to the correct field position. This happens when the link directs to an inactive tab and has to scroll over many fields. (Earlier the tab change was also broken but got fixed in 23.11.) Adding a small delay between tab change and finding the new coordinates seems to fix the issue. Prerequisites for testing: 1. Make sure there are enough editable fields in the biblio framework you'll use for testing to require plenty of scrolling. 2. Make sure that there are enough required fields in the biblio framework to trigger error messages and getting to these fields requires scrolling. Test plan: 1. Go to cataloging and Add record. 2. Try to save the record without filling in the required fields. 3. Click -> Go to field link that directs to an inactive tab. 4. Note that while the tab changes correctly, the window doesn't quite scroll far enough to the correct field. 5. Try also clicking the links for active tabs, and note that scrolling works fine. 5. Apply patch and refresh cache. 6. Repeat steps 1-3. 7. Note that the window scrolls to the position of the correct field even when tab changes. --- .../intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 85b41b2daf..d1dd8c736c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -196,7 +196,7 @@ var field = $(this).data("field"); var tablink = $("a[data-tabname='tab" + tab + "XX']" ).get(0).hash; selectTab( tablink ); - window.scrollTo( 0, getScrollto( field, "toolbar" ) ); + setTimeout( window.scrollTo, 100, 0, getScrollto( field, "toolbar" ) ); }); $("body").on("click", ".show-errors", function(e){ -- 2.34.1