Skip to content

Commit

Permalink
fix: indeterminate checkboxes state is not consistent between browsers (
Browse files Browse the repository at this point in the history
#5901)

* fix: indeterminate checkboxes state is not consistent between browsers

It seems that Firefox can have indeterminate checked checkboxes while Chrome don't.

* doc: changelog entry added

Co-authored-by: Oliver Valls <oliver.vh@coditramuntana.com>
  • Loading branch information
leio10 and tramuntanal committed Mar 30, 2020
1 parent a728cf9 commit 904bf54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -54,6 +54,7 @@ Due to [\#5553](https://github.com/decidim/decidim/pull/5553), SSL is turned on
- **decidim-core**: Fix missing tribute source map [\#5869](https://github.com/decidim/decidim/pull/5869)
- **decidim-api**: Force signin on API if the organization requires it [\#5859](https://github.com/decidim/decidim/pull/5859)
- **decidim-core**: Apply security patch for GHSA-65cv-r6x7-79hv [\#5896](https://github.com/decidim/decidim/pull/5896)
- **decidim-core**: Fix proposals filtering by scope in Chrome [\#5901](https://github.com/decidim/decidim/pull/5901)
- **decidim-comments**: Don't allow comments deeper than a certain depth, at the API level [\#5553](https://github.com/decidim/decidim/pull/5553)
- **decidim-core**: Force SSL and HSTS [\#5553](https://github.com/decidim/decidim/pull/5553)
- **decidim-core**: Do not expose Ruby version in production [\#5553](https://github.com/decidim/decidim/pull/5553)
Expand Down
Expand Up @@ -99,9 +99,9 @@
const checkedInputs = document.querySelectorAll(
`#${checksContext} input[type='checkbox']:checked`
);
const indeterminateInputs = Array.from(checkedInputs).filter((checkbox) => checkbox.indeterminate)
const indeterminateInputs = Array.from(totalInputs).filter((checkbox) => checkbox.indeterminate)

if (checkedInputs.length === 0) {
if (checkedInputs.length === 0 && indeterminateInputs.length === 0) {
global.checked = false;
global.indeterminate = false;
} else if (checkedInputs.length === totalInputs.length && indeterminateInputs.length === 0) {
Expand Down Expand Up @@ -152,9 +152,9 @@
const checkedSiblings = document.querySelectorAll(
`#${checkBoxContext} > div > [data-children-checkbox] > input:checked, #${checkBoxContext} > [data-children-checkbox] > input:checked`
);
const indeterminateSiblings = Array.from(checkedSiblings).filter((checkbox) => checkbox.indeterminate)
const indeterminateSiblings = Array.from(totalCheckSiblings).filter((checkbox) => checkbox.indeterminate)

if (checkedSiblings.length === 0) {
if (checkedSiblings.length === 0 && indeterminateSiblings.length === 0) {
parentCheck.checked = false;
parentCheck.indeterminate = false;
} else if (checkedSiblings.length === totalCheckSiblings.length && indeterminateSiblings.length === 0) {
Expand Down

0 comments on commit 904bf54

Please sign in to comment.