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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-01-10 18:10:43 +00:00 committed by Tomas Cohen Arazi
parent 2a5e06094b
commit 5197d63c55
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 12 additions and 9 deletions

View File

@ -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();