empreinte-digitale / orejime

An easy to use consent manager that focuses on accessibility.
https://orejime.empreintedigitale.fr/
Other
156 stars 26 forks source link

DOMException: Failed to execute 'setAttribute' #102

Open kevinmilet opened 6 months ago

kevinmilet commented 6 months ago

Hi!

I am currently experiencing a problem with orejime when clicking on the customize button. In fact, the console gives me this error: orejime.js:2 Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '0' is not a valid attribute name.

And this prevents the modal from opening.

However, I configured orejime as indicated in the doc (plus I also took the example of the implementation of one of our other applications).

Where does the problem come from? Because despite my research, I found nothing conclusive....

Thanks in advance. Kevin

felixgirault commented 6 months ago

Hi, Could you paste your config here so I can try and reproduce the error?

kevinmilet commented 6 months ago

Hi, Here is the configuration, but it works since it is already implemented elsewhere

var textPolicy = 'Politique de confidentialité'; var politiqueLink = 'https://xxx/Politique_donnees.pdf';

window.orejimeConfig = { appElement: '#contenu', privacyPolicy: 'https://xxx/Politique_donnees.pdf', default: false, mustConsent: false, implicitConsent: false, lang: 'fr', translations: { fr: { consentModal: { title: '', description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', }, consentNotice: { description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', learnMore: 'Personnaliser', privacyPolicy: { name: 'politique de confidentialité', text: 'Pour en savoir plus, merci de lire notre {privacyPolicy}.', }, }, 'google-analytics': { description: "Analyse d'audience", }, 'cookie-fonctionnels': { description: 'Cookies strictement nécessaires', }, facebook: { description: 'Cookies publicitaire', }, hotjar: { description: "Cookies d'analyse", }, linkedin: { description: "Cookies d'analyse", }, purposes: { fonctionel: 'Les cookies fonctionnels permettent aux services principaux du site de fonctionner de manière optimale', experience: 'Les cookies de préférences permettent à un site Web de retenir des informations qui modifient la manière dont le site se comporte ou s’affiche, comme votre langue préférée ou la région dans laquelle vous vous situez.', statistic: "Les cookies statistiques aident les propriétaires du site Web, par la collecte et la communication d'informations de manière anonyme, à comprendre comment les visiteurs interagissent avec le site Web.", interne: 'Les cookies internes peuvent être utilisés pour collecter des données personnelles, suivre le comportement de l’utilisateur et servir à des finalités publicitaires.', }, accept: 'Tout accepter', save: 'Sauvegarder', decline: 'Tout refuser', poweredBy: '', }, }, apps: [ { name: 'cookie-fonctionnels', title: 'Cookies strictement nécessaires ', purposes: ['fonctionel'], cookies: ['JSESSIONID', 'chatBot'], required: true, }, { name: 'google-analytics', title: 'Google Analytics', purposes: ['statistic'], cookies: [ '_ga', '_gat', '_gid', 'utma', 'utmb', 'utmc', 'utmt', '__utmz', '_gat_gtag_UA-**', '_gat_UA-**', ], }, { name: 'facebook', title: 'Facebook', purposes: ['interne'], cookies: ['_fbp'], }, { name: 'hotjar', title: 'Hotjar', purposes: ['interne'], cookies: ['_hjid', '_hjTLDTest'], }, { name: 'linkedin', title: 'Linkedin', purposes: ['interne'], cookies: ['li_mc', 'liap', 'lidc', 'li_gc'], }, ], };

Thanks for your help

felixgirault commented 6 months ago

Thank you. Indeed this config seems to work ok on my machine. Do you have any more info on the error in the console ? A detailed trace would be great :)

kevinmilet commented 6 months ago

Hi, After research, it seems that the modals are managed by JSF and Richface (the application is in Java). By removing the modals it works.

Here's complete error in js console: orejime.js:2 Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '0' is not a valid attribute name. at C (https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:3561) at https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:6453 at P (https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:6477) at https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:6022 at P (https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:6223) at A (https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:3911) at R (https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:8504) at v (https://unpkg.com/orejime@2.0.1/dist/orejime.js:2:2234)

Precisions: latest version of orejime don't work whith our application.

felixgirault commented 6 months ago

Thank you for the trace. Sadly, it seems to point to React internals, I don't see orejime code in there… Anyway, if the bug stops when you disable the modals, I think you should investigate those, I won't be able to help you :grimacing:

About the latest version of Orejime, could you tell me why it doesn't work? There may be something we can do to fix that