From bf2c4dee1b5115962c018782c16350d9e9ed2344 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 7 Jan 2022 09:05:02 +0100 Subject: [PATCH] =?UTF-8?q?:bulb:=20N=C2=B04619=20Document=20table-selecta?= =?UTF-8?q?ble-lines.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/table-selectable-lines.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/table-selectable-lines.js b/js/table-selectable-lines.js index f71ea77ea..80146d60e 100644 --- a/js/table-selectable-lines.js +++ b/js/table-selectable-lines.js @@ -32,7 +32,8 @@ $(document).ready(function () { var LINE_WITH_INPUTS_SELECTOR = "tbody>tr>"+CELLS_WITH_INPUT_SELECTOR; - // Tables with inputs inside cells + // Handler that will allow to select a radio or checkbox by clicking anywhere in the cell + // since 3.0.1 N°4619 we are stopping propagation to prevent selecting the line in such case $(document).on('click', TABLE_SELECTOR+':has('+LINE_WITH_INPUTS_SELECTOR+')', function (event) { var $eventTarget = $(event.target); if (shouldExitHandler($eventTarget)) { @@ -41,13 +42,17 @@ $(document).ready(function () { var $cellClicked = $eventTarget.closest("td"); var $cellClickedInput = $cellClicked.find(INPUT_SELECTOR); - if ($cellClickedInput.length === 1) { + if (($cellClickedInput.length === 1) + && ($cellClickedInput.is("input:radio") || $cellClickedInput.is("input:checkbox")) + ) { $cellClickedInput.click(); + $eventTarget.stopPropagation(); } }); // Tables with one input in the first cell to select lines + // When clicking anywhere in the line (but on certain specific markup) we will click on the radio/checkbox input in the first cell $(document).on('click', TABLE_SELECTOR+':has('+LINE_WITH_INPUT_IN_FIRST_CELL_SELECTOR+')', function (event) { var $eventTarget = $(event.target); if (shouldExitHandler($eventTarget)) {