diff --git a/src/cookie-consent.mjs b/src/cookie-consent.mjs index c50aa3b..41c9fcd 100644 --- a/src/cookie-consent.mjs +++ b/src/cookie-consent.mjs @@ -71,7 +71,8 @@ export default class Dialog extends HTMLElement { saveButtonText: Config().get("labels.aria.button"), defaultButtonLabel: Config().get("labels.button.default"), acceptAllButton: - Config().get("acceptAllButton") && !Preferences().hasPreferences(), + Config().get("acceptAllButton") + && !Preferences().hasPreferences(), }; // custom content from data-attributes const customContent = { @@ -185,9 +186,9 @@ export default class Dialog extends HTMLElement { const checkedCount = values.filter((v) => v.accepted).length; const userOptionsChecked = checkedCount >= requiredCount; if ( - this.data.acceptAllButton && - this.config.type === "checkbox" && - !userOptionsChecked + this.data.acceptAllButton + && this.config.type === "checkbox" + && !userOptionsChecked ) { return values.map((value) => ({ ...value, @@ -250,8 +251,7 @@ export default class Dialog extends HTMLElement { // Loop through arrayfiedTabListChildren tabListChildren.forEach((input) => { // Find all input elements - const inputElement = - input.firstElementChild.firstElementChild.firstElementChild; + const inputElement = input.firstElementChild.firstElementChild.firstElementChild; // Loop through updated cookies this.cookies.forEach((cookie) => { // set the checked state to the updated cookie state diff --git a/src/dialog-tablist.mjs b/src/dialog-tablist.mjs index a6c2509..c84a178 100644 --- a/src/dialog-tablist.mjs +++ b/src/dialog-tablist.mjs @@ -27,10 +27,9 @@ const DialogTabList = (cookieInformation) => { * `required: false`, because of #3) * 3. Use the `checked` setting. */ - const shouldBeChecked = - typeof accepted !== "undefined" - ? accepted - : required === true + const shouldBeChecked = typeof accepted !== "undefined" + ? accepted + : required === true ? required : checked; @@ -96,9 +95,7 @@ const DialogTabList = (cookieInformation) => { : undefined, })); return ` -