Skip to content

Commit

Permalink
DIG-1127 | Fixed tab icon for CC Bar Accept all button.
Browse files Browse the repository at this point in the history
  • Loading branch information
keeteean authored and l-besenyei committed May 25, 2022
1 parent f081e60 commit e1fa33d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
13 changes: 11 additions & 2 deletions build/cookieconsent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1425,17 +1425,26 @@ var Interface = /*#__PURE__*/function () {
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var tabGroup = _step.value;
var lightSwitch = tabGroup.querySelector('button.ccm__switch-group');
var tabStatus = tabGroup.querySelector('.ccm__tab-head__status');

if (window.CookieConsent.config.categories[tabGroup.dataset.category].checked) {
if (!tabGroup.classList.contains('checked-5jhk')) {
tabGroup.classList.add('checked-5jhk');
tabGroup.querySelector('button.ccm__switch-group').setAttribute('aria-checked', 'true');
lightSwitch.setAttribute('aria-checked', 'true');
tabStatus.classList.remove('ccm__tab-head__status--unchecked');
tabStatus.setAttribute('aria-label', Language.getTranslation(window.CookieConsent.config, window.CookieConsent.config.language.current, 'checked'));
tabStatus.textContent = '✔';
tabStatus.classList.add('ccm__tab-head__status--checked');
}

;
} else {
if (tabGroup.classList.contains('checked-5jhk')) tabGroup.classList.remove('checked-5jhk');
tabGroup.querySelector('button.ccm__switch-group').setAttribute('aria-checked', 'false');
lightSwitch.setAttribute('aria-checked', 'false');
tabStatus.setAttribute('aria-label', Language.getTranslation(window.CookieConsent.config, window.CookieConsent.config.language.current, 'unchecked'));
tabStatus.textContent = '×';
tabStatus.classList.add('ccm__tab-head__status--unchecked');
}
}
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion build/cookieconsent.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/cookieconsent.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs_src/src/assets/js/cookieconsent.min.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions src/lib/Interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,24 @@ export default class Interface {
var tabGroups = this.elements['modal'].querySelectorAll('.ccm__tabgroup');

for(let tabGroup of tabGroups) {
var lightSwitch = tabGroup.querySelector('button.ccm__switch-group');
var tabStatus = tabGroup.querySelector('.ccm__tab-head__status');

if(window.CookieConsent.config.categories[tabGroup.dataset.category].checked) {
if( ! tabGroup.classList.contains('checked-5jhk')) {
tabGroup.classList.add('checked-5jhk');
tabGroup.querySelector('button.ccm__switch-group').setAttribute('aria-checked', 'true');
lightSwitch.setAttribute('aria-checked', 'true');
tabStatus.classList.remove('ccm__tab-head__status--unchecked');
tabStatus.setAttribute('aria-label', Language.getTranslation(window.CookieConsent.config, window.CookieConsent.config.language.current, 'checked'));
tabStatus.textContent = '✔';
tabStatus.classList.add('ccm__tab-head__status--checked');
};
} else {
if(tabGroup.classList.contains('checked-5jhk')) tabGroup.classList.remove('checked-5jhk');
tabGroup.querySelector('button.ccm__switch-group').setAttribute('aria-checked', 'false');
lightSwitch.setAttribute('aria-checked', 'false');
tabStatus.setAttribute('aria-label', Language.getTranslation(window.CookieConsent.config, window.CookieConsent.config.language.current, 'unchecked'));
tabStatus.textContent = '×';
tabStatus.classList.add('ccm__tab-head__status--unchecked');
}
}
}
Expand Down

0 comments on commit e1fa33d

Please sign in to comment.