From 9708bbe276082ddc2fa4402c2e84e195e4a3a68d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 13 Aug 2020 13:17:59 +0100 Subject: [PATCH] Bug 26039: Focus and Scroll to ShelfBrowser on load When the shelf browser link is clicked we perform a full page reload which results in a reset in the context. We should immediately focus the shelf browser and scroll to that region to highlight the change of content. Test plan 1/ Enable shelf browser 2/ Search for an item in the open and navigate to the detail page 3/ Click the 'Browse shelf' link 4/ Note that upon page reload the screen scrolls to the 'Browsing...' location of the screen. 5/ Note that the 'Browsing...' title is 'focused' 6/ Signoff. Signed-off-by: Stina Hallin Signed-off-by: Katrin Fischer JD amended patch: correctly align JS code Signed-off-by: Jonathan Druart --- .../bootstrap/en/includes/shelfbrowser.inc | 4 ++-- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc index f7e35adc58..253fe20893 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc @@ -1,13 +1,13 @@ [% BLOCK shelfbrowser %] [% IF OpenOPACShelfBrowser %]
-
+
[%- IF ( starting_homebranch ) %]Browsing [% starting_homebranch | html %] shelves[% END -%] [%- IF ( starting_homebranch && starting_location ) %], [% END %] [%- IF ( starting_location ) %]Shelving location: [%- starting_location | html -%][% END -%] [%- IF ( starting_homebranch && starting_ccode ) %], [% END %] [%- IF ( starting_ccode ) %]Collection: [%- starting_ccode | html -%][% END -%] - Close shelf browser + Close shelf browser
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 6d9bc456b6..f8dce1e0a1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1249,9 +1249,9 @@ [% ITEM_RESULT.itemcallnumber | html %] [% IF ( OPACShelfBrowser ) %] [% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %] - (Browse shelf) + (Browse shelf) [% ELSE %] - (Browse shelf) + (Browse shelf) [% END %] [% END %] [% END %] @@ -1578,6 +1578,15 @@ [% END %] [% IF ( OPACShelfBrowser ) %] + // Focus on shelf browser if present + var shelfbrowser = $("#shelfbrowser"); + if (shelfbrowser.length > 0) { + $('html,body').animate({ + scrollTop: shelfbrowser.first().offset().top + }, + 'slow'); + shelfbrowser.first().find(':focusable').eq(0).focus(); + } (function prepareShelfBrowser(){ -- 2.39.5