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

[Bug]: disablePageInteraction is not working #744

Open
fmonsalvo opened this issue Oct 24, 2024 · 1 comment
Open

[Bug]: disablePageInteraction is not working #744

fmonsalvo opened this issue Oct 24, 2024 · 1 comment

Comments

@fmonsalvo
Copy link

Expected Behavior

According to the documentation by setting disablePageInteraction to true, an overlay blocks any interaction with the underlying page until the cookie consent has been interacted with.

Current Behavior

The overlay is not showing and scrolling is enabled.

Steps to reproduce

Create a NextJs app, install vanilla cookie consent, configure it like this:

useEffect(() => {
    CookieConsent.run({
      autoShow: false,
      disablePageInteraction: true,
      categories: {
        necessary: {
          enabled: true,
          readOnly: true,
        },
        functional: {
          enabled: true,
        },
        analytics: {
          enabled: true,
        },
        performance: {
          enabled: true,
        },
        advertisement: {
          enabled: true,
        },
        uncategorized: {
          enabled: true,
        },
      },
      onConsent: ({ cookie }) => {
        setConsent(cookie);
      },
      guiOptions: {
        consentModal: {
          layout: "cloud inline",
        },
        preferencesModal: {
          flipButtons: true,
        },
      },
      language: {
        default: "en",
        translations: {
          en: {
            consentModal: {},
            preferencesModal: {
              title: "Customize Consent Preferences",
              acceptAllBtn: "Accept All Cookies",
              savePreferencesBtn: "Save My Preferences",
              sections: enCookieConsentSections,
            },
          },
        },
      },
    });
  }, []);

Launch the application, scroll is enabled.

Proposed fix or additional info.

No response

Version

3.0.1

On which browser do you see the issue?

Firefox, Chrome, Safari

@fmonsalvo fmonsalvo added the bug Something isn't working label Oct 24, 2024
@github-actions github-actions bot added the triage yet to be reviewed label Oct 24, 2024
@orestbida orestbida removed bug Something isn't working triage yet to be reviewed labels Nov 11, 2024
@orestbida
Copy link
Owner

The overlay is set only if the consentModal is visible.

Noticed you have set autoShow: false, so I assume you are manually calling the .show() method.

Works fine on my end.

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