Bug 32999

Summary: Click handler to show QR code in OPAC lacks preventDefault
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Kyle M Hall <kyle>
Severity: trivial    
Priority: P5 - low CC: arthur.suzuki, kyle, lucas, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04,22.05.11, 21.11.19
Bug Depends on: 23566    
Bug Blocks:    
Attachments: Bug 32999: Click handler to show QR code in OPAC lacks preventDefault
Bug 32999: Click handler to show QR code in OPAC lacks preventDefault
Bug 32999: Click handler to show QR code in OPAC lacks preventDefault

Description Owen Leonard 2023-02-17 16:06:58 UTC
If you're scrolled down on the OPAC bibliographic detail page and click the "Send to device" link, the page jumps up to the top because the click handler doesn't have a "return false" or "event.preventDefault()".
Comment 1 Owen Leonard 2023-02-17 16:22:43 UTC
Created attachment 146857 [details] [review]
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.
Comment 2 Lucas Gass 2023-02-17 16:50:13 UTC
Created attachment 146869 [details] [review]
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>
Comment 3 Kyle M Hall 2023-02-17 18:05:45 UTC
Created attachment 146900 [details] [review]
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>
Comment 4 Tomás Cohen Arazi 2023-02-20 12:55:12 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 5 Martin Renvoize 2023-02-24 08:31:53 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 6 Lucas Gass 2023-03-01 14:46:38 UTC
Backported to 22.05.x for upcoming 22.05.11
Comment 7 Arthur Suzuki 2023-03-29 09:20:48 UTC
applied to 21.11.x for 21.11.19
Comment 8 wainuiwitikapark 2023-04-27 04:28:53 UTC
Not backported to 21.05.x