From 3e3b972b5b0e6eec8df1d0a5a562df7496ab4db1 Mon Sep 17 00:00:00 2001 From: hamid roohani Date: Sun, 8 Sep 2024 00:06:54 +0200 Subject: [PATCH 1/2] The toggleAllCheckboxes function should not check a disable checkbox Close #14137 --- .../resources/views/components/checkbox-list.blade.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/forms/resources/views/components/checkbox-list.blade.php b/packages/forms/resources/views/components/checkbox-list.blade.php index a63d65baafc..9659d72db48 100644 --- a/packages/forms/resources/views/components/checkbox-list.blade.php +++ b/packages/forms/resources/views/components/checkbox-list.blade.php @@ -33,8 +33,10 @@ this.visibleCheckboxListOptions.forEach((checkboxLabel) => { checkbox = checkboxLabel.querySelector('input[type=checkbox]') - checkbox.checked = state - checkbox.dispatchEvent(new Event('change')) + if (!checkbox.disabled) { + checkbox.checked = state + checkbox.dispatchEvent(new Event('change')) + } }) this.areAllCheckboxesChecked = state From bc42c8a3d9af3ee886cb4a5676640492cf767470 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Sun, 8 Sep 2024 17:47:12 +0100 Subject: [PATCH 2/2] Update checkbox-list.blade.php --- .../resources/views/components/checkbox-list.blade.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/forms/resources/views/components/checkbox-list.blade.php b/packages/forms/resources/views/components/checkbox-list.blade.php index 9659d72db48..cd2f262d4ec 100644 --- a/packages/forms/resources/views/components/checkbox-list.blade.php +++ b/packages/forms/resources/views/components/checkbox-list.blade.php @@ -33,10 +33,12 @@ this.visibleCheckboxListOptions.forEach((checkboxLabel) => { checkbox = checkboxLabel.querySelector('input[type=checkbox]') - if (!checkbox.disabled) { - checkbox.checked = state - checkbox.dispatchEvent(new Event('change')) + if (checkbox.disabled) { + return } + + checkbox.checked = state + checkbox.dispatchEvent(new Event('change')) }) this.areAllCheckboxesChecked = state