From 849587fc0fc4fa41fb9368f574c1b91c82b9f4d1 Mon Sep 17 00:00:00 2001 From: Jake Deery Date: Tue, 23 Sep 2025 10:57:34 +0000 Subject: [PATCH] Bug 40783: Result page checkbox now triggers click This patch changes the behaviour off the checkboxes on the results page, so that instead of causing a form submission (essentially, a page refresh), the checkbox will now follow the same behaviour as if it were clicked. TO TEST: a) go to /cgi-bin/koha/opac-search.pl?idx=kw&q=history&sort_by=relevance b) add an item to your cart (ensure the syspref is enabled) c) tab through the results until you come across a checkbox, press return d) notice your page refreshes, as a form submission has happened APPLY PATCH e) repeat steps a-c f) notice the page no longer refreshes, and that no form submission occurs g) notice that the checkbox is now checked, as if it had been clicked h) notice the items are still in your cart and can be interacted with normally SIGN OFF --- koha-tmpl/opac-tmpl/bootstrap/js/results-list.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/results-list.js b/koha-tmpl/opac-tmpl/bootstrap/js/results-list.js index cb1889207a7..0adde97cbd6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/results-list.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/results-list.js @@ -127,8 +127,17 @@ function tagAdded() { } $(document).ready(function () { - $(".cb").click(function () { - enableCheckboxActions(); + $('.cb').each((idx, element) => { + $(element).on('click', () => { + enableCheckboxActions(); + }); + $(element).on('keydown', event => { + if (event.key === 'Enter') { + event.preventDefault(); + $(element).trigger('click'); + return false; + } + }); }); enableCheckboxActions(); -- 2.43.0