From a48801d1406f79d6e3e81d0f197c21f4ff5f6518 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 28 Apr 2022 11:37:31 +0000 Subject: [PATCH] Bug 30640: Focus does not always move to correct search header form field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch updates the staff interface's global JavaScript to accommodate changes in the way focus is being handled after the jQuery upgrade (see: https://github.com/jquery/jquery/issues/4950). The "focus" class is removed from search header include files so that there isn't a contradiction between which form field has the focus class and which form field is displayed in the active tab. To test, apply the patch and view various pages in the staff interface. - On pages where focus is not being directed to a form field within the main content of the page, the form field in the active search header tab should have focus on page load: - Patron details - System preferences - Cities and towns Also test pages where a tab other than the first one is preselected: - Bibliographic details page - Patron lists On these pages, focus should move to the active tab's form field when you switch tabs. - On pages where focus is being sent to another form field, it should work correctly: - Patrons home page - Check in - Acquisitions home page Signed-off-by: Séverine Queune Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/includes/patron-search-box.inc | 4 ++-- .../prog/en/includes/patron-search-header.inc | 2 +- .../intranet-tmpl/prog/en/modules/admin/admin-home.tt | 8 -------- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 9 ++++++++- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc index 726e39d30dc..2dff1ba588e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc @@ -4,7 +4,7 @@ [% IF ( PatronAutoComplete ) %]
- + [% IF ( stickyduedate ) %] @@ -12,7 +12,7 @@ [% END %]
[% ELSE %] - + [% IF ( stickyduedate ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc index f5e8dddcded..ff17ca92804 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc @@ -11,7 +11,7 @@
- + [-] [+] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index 1b99885b9a8..cd15f66e046 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -275,12 +275,4 @@
-[% MACRO jsinclude BLOCK %] - -[% END %] - [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index ad51b99e1b7..f2becd2a7fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -49,7 +49,14 @@ $.fn.selectTabByID = function (tabID) { }; $(document).ready(function() { - $('#header_search').tabs().on( "tabsactivate", function() { $(this).find("div:visible").find('input').eq(0).focus(); }); + $('#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(); }); -- 2.25.1