From db04e01f66cd39f1cee1d47774d6d6349559f78c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 17 Feb 2023 16:07:36 +0000 Subject: [PATCH] Bug 32999: Click handler to show QR code in OPAC lacks preventDefault This patch adds "preventDefault()" to the click handler for showing the bibliographic detail QR code. This prevents the page from scrolling to the top when the user clicks the link. To test, apply the patch and make sure the OPACDetailQRCode system preference is enabled. Locate a bibliographic record and view the detail page. If necessary, reduce the size of your browser window so that you have to scroll down a bit to bring the "Send to device" menu item into view in the sidebar. Click the link to confirm that it shows the QR code and that the page doesn't jump to the top. Signed-off-by: Lucas Gass Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 5ba3eea4959cc9a89ff21b92fb12c342fed973d7) Signed-off-by: Martin Renvoize --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 c6fb1c26c6..61eae02a36 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1680,7 +1680,8 @@ document.getElementById("qrcode").appendChild( qrcode ); } - $(".show_qrcode").on("click", function(){ + $(".show_qrcode").on("click", function(e){ + e.preventDefault(); var qrcodeImg = $("#qrcode"); if( qrcodeImg.hasClass("d-none") ){ qrcodeImg.removeClass("d-none"); -- 2.39.5