whitecube / laravel-cookie-consent

Register, configure and ask for cookies consent in a EU-compliant way
MIT License
312 stars 37 forks source link

Accept buttons not working on first click #47

Open nlukic97 opened 4 months ago

nlukic97 commented 4 months ago

I have noticed scenarious where clicking on "Accept all" or "Accept essentials" will not work (popup box remains open). In such cases, users have to click a second time for the popup box to close.

This issue was the placement of @cookieconsentscripts - if there are other script tags of a larger size above it, the cookie box will open without the actual laravel-cookie-consent javascript being loaded, so clicking on it will throw an undefined error:

image

The solution is to move @cookieconsentscripts above all other script tags to ensure it loads first.

However, I would suggest displaying the popup box after the event DOMContentLoaded is fired

patricksebastien commented 4 weeks ago

@nlukic97 I tried your suggestion (script at the very top), but still no luck for me.

@toonvandenbos Any input on the proposition for "after the event DOMContentLoaded is fired"

toonvandenbos commented 4 weeks ago

I'm not against the idea of masking the DOM element until the document is fully loaded when JavaScript is enabled since the whole point of this package is to work when JS is not enabled too. If somebody has some time to work on a PR having these constraints in mind, that would be helpful! Thanks :)

nlukic97 commented 4 weeks ago

Sure, i’ll start working on it

On Thu, 8 Aug 2024 at 19:08, Toon Van den Bos @.***> wrote:

I'm not against the idea of masking the DOM element until the document is fully loaded when JavaScript is enabled since the whole point of this package is to work when JS is not enabled too. If somebody has some time to work on a PR having these constraints in mind, that would be helpful! Thanks :)

— Reply to this email directly, view it on GitHub https://github.com/whitecube/laravel-cookie-consent/issues/47#issuecomment-2276286864, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANSJ22J7L3UK7YRLGNME3HLZQOQXNAVCNFSM6AAAAABHJSDNKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZWGI4DMOBWGQ . You are receiving this because you were mentioned.Message ID: @.***>