Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serviceconfig optOut not working for contextual consent elements #536

Closed
sascha-meissner opened this issue Feb 20, 2025 · 1 comment
Closed

Comments

@sascha-meissner
Copy link

sascha-meissner commented Feb 20, 2025

Klaro Config

var tutorialConfig = {

    acceptAll: true,
    services: [
        {
            purposes: ['marketing'],
            name: "demo-youtube",
            default: true,
            optOut: true,

        }
    ]
}
window.addEventListener("DOMContentLoaded", function(e){
    klaro.show(tutorialConfig)
})

HTML Code of Page

<iframe width="560" height="315" data-name="demo-youtube" data-src="https://www.youtube.com/embed/bsZOn0R8VH8?si=8BLnuJSp3xVRilyb" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

<div data-name="demo-youtube">
  <h2>Also not working for other elements ...not only iframe </h2>
</div>

Steps to reproduce

(load the klaro css and js) add my code and load the page

Current behavior

The contextual element is shown instead of the video

Expected behavior

but expected would be to display the video, as it is activated on default and optOut is true

@werk21
Copy link
Contributor

werk21 commented Feb 21, 2025

The problem is in this line:
https://github.com/klaro-org/klaro-js/blob/6ccb3534daaba8114ecd2223a8dc688da13c4e3d/src/lib.js#L114
consent is only true, if manager.confirmed i set - and this is always false in this case (optout should be loaded before consent).

This should be:
const consent = manager.getConsent(service.name) && (manager.confirmed || service.optOut)

werk21 added a commit to werk21/klaro-js that referenced this issue Feb 21, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@adewes adewes closed this as completed in b6a0436 Mar 27, 2025
adewes added a commit that referenced this issue Mar 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix #536: Check for optOut state while contextual rendering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants