Skip to content

Commit b68d82c

Browse files
authored
fix: remove interaction blocker when modal is hidden by extension (#404)
1 parent a54fbf7 commit b68d82c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

apps/blog/src/app/providers/tracking/cookie-consent.config.ts

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ export const cookieConsentConfig = {
2727
cookie: {
2828
name: 'cc_cookie_al',
2929
},
30+
onModalShow: () => {
31+
const ccEl = document.getElementById('cc-main');
32+
// Check if the cookie consent dialog has been hidden by injected styles from an external extension (e.g., "I don't care about cookies").
33+
// To respect this and avoid issues with the `disablePageInteraction` flag, we manually remove the overlay that blocks page interaction.
34+
if (ccEl && window.getComputedStyle(ccEl).display === 'none') {
35+
// Reference: https://github.com/orestbida/cookieconsent/blob/e6279509aab5b96be198297b0283b321ad76b0a9/src/utils/constants.js#L8C50-L8C70
36+
document.documentElement.classList.remove('disable--interaction');
37+
}
38+
},
3039
onConsent: () => {
3140
window.dataLayer.push({ event: 'consent_update' });
3241
window.dispatchEvent(new CustomEvent('ptupdate'));

0 commit comments

Comments
 (0)