From de4434bd4a73b06de1c06a24306368f5531bf39f 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=utf8 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 Signed-off-by: Fridolin Somers --- .../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 726e39d30d..2dff1ba588 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 f5e8dddcde..ff17ca9280 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 1b99885b9a..cd15f66e04 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 ad51b99e1b..f2becd2a7f 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.39.5