From f7a98c925d2105a8276c75200e668f5aa49d43e2 Mon Sep 17 00:00:00 2001 From: Ahmad Game Date: Thu, 27 Jun 2019 11:30:43 +0200 Subject: [PATCH] When running in debug mode, the scroll liteneris always added regardless of weather the acceptOnScroll was set to true or false --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 345719e..037e634 100644 --- a/src/index.js +++ b/src/index.js @@ -66,8 +66,8 @@ class CookieConsent extends Component { this.setState({ visible: true }); } - // if acceptOnScroll is set to true and cookie is undefined or debug is set to true, add a listener. - if ((this.props.acceptOnScroll && Cookies.get(cookieName) === undefined) || debug) { + // if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener. + if (this.props.acceptOnScroll && (Cookies.get(cookieName) === undefined || debug)) { window.addEventListener("scroll", this.handleScroll, { passive: true }); } }