To recreate: 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. Note: This issue is present in master and 22.05.x, as far as I can tell.
Could the reason be the empty searchid param? This doesn't work: http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=126&itemnumber=263&searchid=#edititem This does work (sometimes) http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=126&itemnumber=263&searchid=5#edititem
For me the empty searchid parameter doesn't seem to matter. If I click 'Edit item', I am still at the top of the page ( fragment doesn't work ) but if I then go to the address bar and press return to refresh I am taken to the #edititem location. ( fragment does work )
I believe it is the tabs: koha-tmpl/intranet-tmpl/prog/js/staff-global.js 51 $(document).ready(function() { 52 $('#header_search').tabs({ 53 create: function( e, ui ){ 54 ui.panel.find("input:text:first").focus(); 55 }, 56 activate: function ( e, ui ) { 57 ui.newPanel.find("input:text:first").focus(); 58 } 59 }); They are moving the focus to the header search when the tabs are loaded - refreshing from the url doesn't fully reload the page, so the anchor works as we don't trigger the focus
Confirmed 22.05.07 and up
(In reply to Nick Clemens from comment #3) > I believe it is the tabs: > koha-tmpl/intranet-tmpl/prog/js/staff-global.js > 51 $(document).ready(function() { > 52 $('#header_search').tabs({ > 53 create: function( e, ui ){ > 54 ui.panel.find("input:text:first").focus(); > 55 }, > 56 activate: function ( e, ui ) { > 57 ui.newPanel.find("input:text:first").focus(); > 58 } > 59 }); > > They are moving the focus to the header search when the tabs are loaded - > refreshing from the url doesn't fully reload the page, so the anchor works > as we don't trigger the focus 100% correct. I think we could check for the existence of a hash before we set the focus.
Created attachment 145200 [details] [review] 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.
This does interrupt workflows so I am setting the importance to normal.
Created attachment 145203 [details] [review] 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 <david@davidnind.com>
Created attachment 145572 [details] [review] 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 <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 23.05. Nice work everyone, thanks!
Nice work everyone! Pushed to stable for 22.11.x
This fix does not work with 22.05.x, no backport.