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 <lucas@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-02-17 16:07:36 +00:00 committed by Tomas Cohen Arazi
parent d18772c3c2
commit 5ba3eea495
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 2 additions and 1 deletions

View File

@ -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");