orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js
https://playground.cookieconsent.orestbida.com/
MIT License
3.68k stars 387 forks source link

[Bug]: Background entry animation ignored #697

Open Massi-X opened 2 weeks ago

Massi-X commented 2 weeks ago

Expected Behavior

The background of . cm-wrapper should animate

Current Behavior

The background of . cm-wrapper does not animate

Steps to reproduce

Hi and thank you for this awesome module! I found a strange bug regarding the background of the main consent window. You can test this even on playground.

  1. First check "Disable page interaction" so that the background is effectively there
  2. You can instantly notice how the background is animated (to test again, close the popup and click on "Flip buttons" or anything else)
  3. Now open your console and type CookieConsent.show() (with no argument or true/false, doesn't matter)
  4. You can now see the background fails to animate

From a first sight I didn't catch anything wrong in the code, but I will check further later, do you already have any ideas maybe?

Proposed fix or additional info.

No response

Version

3.0.1

On which browser do you see the issue?

Chrome/Firefox

Massi-X commented 2 weeks ago

OK, found the issue! When creating the modal in line https://github.com/orestbida/cookieconsent/blob/c4d512f362b49556fd57632acbdc7193eb9b9a12/src/core/modals/consentModal.js#L282 the .cc--anim class is correctly added after a timeout of 100ms, while on show there is no such timeout cause the class is never removed.

See https://github.com/orestbida/cookieconsent/pull/698 for the fix