Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Cookie banner still reappears after clicking accept on page refresh/navigation #1189

Closed
regoawt opened this issue Sep 28, 2023 · 1 comment · Fixed by #1257
Closed

Cookie banner still reappears after clicking accept on page refresh/navigation #1189

regoawt opened this issue Sep 28, 2023 · 1 comment · Fixed by #1257
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@regoawt
Copy link

regoawt commented Sep 28, 2023

Describe the bug

After initially clicking accept on the cookie banner, the banner goes away. Any subsequent refresh or page navigation causes the banner to reappear, and subsequent clicks of the accept button do nothing.

I cloned the repo and ran it locally, however could not reproduce the error.

Seems effectively the same issue as described in #661 .

Expected Behavior

Cookie banner to stay dismissed.

Current Behavior

Cookie banner reappears on page refresh or navigation and can't be re-dismissed.

Reproduction Steps

As per description.

I tried accessing the site through a VPN from a non-EU location but it made no difference.

Possible Solution

Console is showing error Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' does not appear in the style-src directive of the Content Security Policy. .

Might be caused by inline style added in commit f81934e in file workshop/layouts/partials/docs/inject/head.html conflicting with default stylesheet.

Adding display: none; to default stylesheet instead might be the solution.

Additional Information/Context

No response

CDK CLI Version

No response

Section

No response

Browser

Chrome, Safari

Language

No response

@regoawt regoawt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2023
indrora pushed a commit that referenced this issue Nov 29, 2023
How the cookie banner was presented originally was hacky:

the default style was to use "display:none" and remove the element if it wasn't needed.
This change makes it use a CSS class and an appropriate override.
Functionally, this is identical to the original implementation.

Additionally, the original banner was inside the head of the page.
This caused validation errors and made some browsers upset.
By moving the JS around and making sure it's at the end, the page also loads faster.
indrora added a commit that referenced this issue Nov 30, 2023
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant