orestbida / cookieconsent

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

[Bug]: Unexpected Page Jump after using Button to open #723

Open Paulexe opened 2 months ago

Paulexe commented 2 months ago

Expected Behavior

After opening the cookie banner using the "Show Preferences" or "Show Cookie Banner" button, the page should stay in its current scroll position when the user accepts or rejects the cookies.

Current Behavior

The page unexpectedly jumps back to the position of the "Show Preferences" or "Show Cookie Banner" button, which disrupts the user experience. This issue does not occur in Safari.

Steps to reproduce

On the CookieConsent v3.0.1 Playground :

  1. Open the cookie banner using the "Show Preferences Modal" button.
  2. Scroll the button out of the viewport.
  3. Accept or reject cookies.

Proposed fix or additional info.

Maybe a config option for this?

Version

3.0.1

On which browser do you see the issue?

Firefox, Chrome, Microsoft Edge