From 15ee08ff28bfb3e67c7fd5145fa09374656affbf 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 --- koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc | 4 ++-- koha-tmpl/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 cc32512efd..7bb897954d 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 %] @@ -1583,6 +1583,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.11.0